Documentation ¶
Overview ¶
Package backup provides tools for backing up peers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface { // Delete permanently removes all peers from the backup. Delete(ctx context.Context) error // Backup stores gives peers possibly overwriting the last backup. Backup(ctx context.Context, nsPeers map[string][]peer.AddrInfo) error // Restore returns peers from the last backup. Restore(ctx context.Context) (map[string][]peer.AddrInfo, error) }
Backend is an interface used to backup and restore peer identities and addresses.
func NewCommonStoreBackend ¶
func NewCommonStoreBackend(cs *persistent.CommonStore, bucket string, key string) Backend
NewCommonStoreBackend creates a new common store backend.
The name of the bucket and the key under which peers are stored should be unique to avoid backups to be overwritten.
type InMemoryBackend ¶
type InMemoryBackend struct {
// contains filtered or unexported fields
}
InMemoryBackend uses memory to backup and restore peers. This backend is not persistent and intended for testing purposes only.
func NewInMemoryBackend ¶
func NewInMemoryBackend() *InMemoryBackend
NewInMemoryBackend creates a new in-memory backend.
Click to show internal directories.
Click to hide internal directories.