replication

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: May 3, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentMetatag added in v0.0.16

type ContentMetatag struct {
	Tag         string
	Size        int64
	Type        string
	Name        string
	Hash        cid.Cid
	Timestamp   int64
	Owner       peer.ID
	IsEncrypted bool
	Group       string `json:"omitempty"`
	Links       []*format.Link
}

ContentMetatag keeps meta information of a content in the crdt store

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 GroupMetadata added in v0.0.16

type GroupMetadata struct {
	Name           string
	OwnerID        peer.ID
	OwnerPublicKey []byte
	GroupID        peer.ID
	IsOpen         bool
}

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,
	pubKeyGetter PubKeyGetter,
	autoDownload bool,
) (*Manager, error)

New creates a new replication manager

func (*Manager) Close

func (m *Manager) Close() error

Close the crdt store

func (*Manager) CreateGroup added in v0.0.16

func (m *Manager) CreateGroup(name string, ownerID peer.ID, ownerPrivateKey ic.PrivKey) (*GroupMetadata, error)

func (*Manager) CreateOpenGroup added in v0.0.16

func (m *Manager) CreateOpenGroup(name string, ownerID peer.ID, ownerPrivateKey ic.PrivKey) (*GroupMetadata, error)

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) (*ContentMetatag, 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) GroupAddContent added in v0.0.16

func (m *Manager) GroupAddContent(peerId, groupID peer.ID, privateKey ic.PrivKey, meta *ContentMetatag) error

func (*Manager) GroupAddMember added in v0.0.16

func (m *Manager) GroupAddMember(memberPeerId, newMemberPeerId, groupID peer.ID, memberPrivateKey ic.PrivKey, newMemberPublicKey ic.PubKey) error

func (*Manager) GroupGetAllContent added in v0.0.16

func (m *Manager) GroupGetAllContent(peerId, groupID peer.ID, privateKey ic.PrivKey) ([]*ContentMetatag, error)

func (*Manager) GroupGetAllGroups added in v0.0.16

func (m *Manager) GroupGetAllGroups(ownerID peer.ID, ownerPrivateKey ic.PrivKey) ([]GroupMetadata, error)

func (*Manager) GroupGetInfo added in v0.0.16

func (m *Manager) GroupGetInfo(memberPeerId, groupID peer.ID, memberPrivateKey ic.PrivKey) (*GroupMetadata, error)

func (*Manager) Has

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

Has returns whether the `key` is mapped to a `value`.

func (*Manager) Index added in v0.0.11

func (m *Manager) Index() (map[string]*ContentMetatag, 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 *ContentMetatag) error

Tag a given meta info in the store

type PubKeyGetter added in v0.0.16

type PubKeyGetter interface {
	PubKey(peer.ID) ic.PubKey
}

PubKeyGetter

type Syncer

type Syncer interface {
	Download(context.Context, cid.Cid) error
	FindProviders(context.Context, cid.Cid) []peer.ID
	ConnectIfNotConnectedUsingRelay(context.Context, []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