replication

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DownloaderTask added in v0.0.12

type DownloaderTask struct {
	// contains filtered or unexported fields
}

func (*DownloaderTask) Execute added in v0.0.12

func (d *DownloaderTask) Execute(ctx context.Context) error

func (*DownloaderTask) Name added in v0.0.12

func (d *DownloaderTask) Name() string

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles replication

func New

func New(
	ctx context.Context,
	cancel context.CancelFunc,
	r repo.Repo,
	h host.Host,
	dagSyncer crdt.DAGSyncer,
	st datastore.Batching,
	prefix string,
	topic string,
	broadcastInterval time.Duration,
	syncer Syncer,
) (*Manager, error)

New creates a new replication manager

func (*Manager) Close

func (m *Manager) Close() error

Close the crdt store

func (*Manager) Delete added in v0.0.11

func (m *Manager) Delete(key datastore.Key) error

Delete removes the value for given `key`.

func (*Manager) DownloadManagerStatus added in v0.0.12

func (m *Manager) DownloadManagerStatus() (res map[string]taskmanager.TaskStatus)

DownloadManagerStatus returns taskmanager status for handling downloads

func (*Manager) FindTag

func (m *Manager) FindTag(tag string) (*Metatag, error)

FindTag gets the meta info of a given tag from the store

func (*Manager) Get

func (m *Manager) Get(key datastore.Key) ([]byte, error)

Get retrieves the object `value` named by `key`. Get will return ErrNotFound if the key is not mapped to a value.

func (*Manager) GetAllCids

func (m *Manager) GetAllCids() ([]cid.Cid, error)

GetAllCids returns all the cids in the crdt store

func (*Manager) GetAllTags

func (m *Manager) GetAllTags() ([]string, error)

GetAllTags returns all tags

func (*Manager) Has

func (m *Manager) Has(key datastore.Key) (bool, error)

Has returns whether the `key` is mapped to a `value`. In some contexts, it may be much cheaper only to check for existence of a value, rather than retrieving the value itself. (e.g. HTTP HEAD). The default implementation is found in `GetBackedHas`.

func (*Manager) Index added in v0.0.11

func (m *Manager) Index() (map[string]*Metatag, error)

Index returns the tag-mata info as key:value

func (*Manager) Put

func (m *Manager) Put(key datastore.Key, v []byte) error

Put stores the object `value` named by `key`.

func (*Manager) StartContentWatcher

func (m *Manager) StartContentWatcher()

StartContentWatcher watches on incoming contents and gets content in datastore

func (*Manager) StartUnfinishedDownload added in v0.0.12

func (m *Manager) StartUnfinishedDownload(pid peer.ID)

StartUnfinishedDownload starts unfinished downloads once peer comes back

func (*Manager) Tag

func (m *Manager) Tag(tag string, meta *Metatag) error

Tag a given meta info in the store

type Metatag added in v0.0.11

type Metatag struct {
	Tag         string
	Size        int64
	Type        string
	Name        string
	Hash        cid.Cid
	Timestamp   int64
	Owner       peer.ID
	IsEncrypted bool
}

Metatag keeps meta information of a content in the crdt store

type Syncer

type Syncer interface {
	Download(context.Context, cid.Cid) error
	FindProviders(context.Context, cid.Cid) []peer.ID
}

Syncer gets the file and finds file provider from the network

Jump to

Keyboard shortcuts

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