sync

package
v0.1.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataSync

type DataSync struct {
	Sync
}

DataSync represents a data synchronizer, which implements the Sync interface

func NewDataSync

func NewDataSync(sync Sync) *DataSync

NewDataSync creates a new instance of DataSync

func (*DataSync) CompareBucketHashes

func (ds *DataSync) CompareBucketHashes(ctx context.Context, hashes map[uint32]string) ([]uint32, error)

CompareBucketHashes groups assets in a bucket and compares individual bucket checksums

func (*DataSync) CompareTopHash

func (ds *DataSync) CompareTopHash(ctx context.Context, topHash string) (bool, error)

CompareTopHash compares the local top hash with the given hash

type Sync

type Sync interface {
	// GetTopHash returns the local top checksum
	GetTopHash(ctx context.Context) (string, error)
	// GetBucketHashes returns local checksums of all buckets
	GetBucketHashes(ctx context.Context) (map[uint32]string, error)
	// GetAssetsOfBucket retrieves assets of a bucket either from local or remote storage
	GetAssetsOfBucket(ctx context.Context, bucketNumber uint32, isRemote bool) ([]cid.Cid, error)
	DeleteAsset(root cid.Cid) error
	AddLostAsset(root cid.Cid) error
}

Sync defines the synchronization interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL