linker

package module
v0.0.0-...-63c195f Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const LinkAddress = "/link" + "/address/" + Version
View Source
const LinkHash = "/link" + "/hash/" + Version
View Source
const LinkPeers = "/link" + "/peers/" + Version
View Source
const Version = "0.0.1"

Variables

View Source
var NewLine = []byte{'\n'}

Functions

This section is empty.

Types

type Cache

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

func (*Cache) Close

func (c *Cache) Close() error

Close ...

func (*Cache) Load

func (c *Cache) Load(hash string, data json.Unmarshaler) error

LoadNode ...

func (*Cache) Range

func (c *Cache) Range(f func(key, value string) bool)

Range ...

func (*Cache) Store

func (c *Cache) Store(hash string, data json.Marshaler) error

SaveNode ...

func (*Cache) Update

func (c *Cache) Update(hash string, up CacheUpdater) error

Update ...

func (*Cache) UpdateBytes

func (c *Cache) UpdateBytes(hash string, b []byte) error

type CacheUpdater

type CacheUpdater interface {
	json.Unmarshaler
	Do()
	json.Marshaler
}

type Cacher

type Cacher interface {
	Load(hash string, data json.Unmarshaler) error
	Store(hash string, data json.Marshaler) error
	Update(hash string, up CacheUpdater) error
	Close() error
	Range(f func(hash string, value string) bool)
}

Cacher ...

func NewCache

func NewCache(cfg config.CacheConfig, path, name string) Cacher

NewCache ...

type DataHashInfo

type DataHashInfo struct {
	DataHash string `json:"data_hash"`
}

DataHashInfo ...

func (DataHashInfo) Hash

func (v DataHashInfo) Hash() string

HashCache ...

func (DataHashInfo) Marshal

func (v DataHashInfo) Marshal() ([]byte, error)

Marshal ...

func (*DataHashInfo) Unmarshal

func (v *DataHashInfo) Unmarshal(b []byte) error

Unmarshal ...

type HashCache

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

func NewHash

func NewHash(cfg *config.Config, node *core.IpfsNode) *HashCache

func (*HashCache) Add

func (c *HashCache) Add(hash string, id peer.ID) (b bool)

func (*HashCache) CheckHash

func (c *HashCache) CheckHash(hash string) (b bool)

func (*HashCache) CheckHashPeer

func (c *HashCache) CheckHashPeer(hash string, id peer.ID) (b bool)

func (*HashCache) Get

func (c *HashCache) Get(hash string) peer.IDSlice

type Linker

type Linker interface {
	SetNode(node *core.IpfsNode) Linker
	Start() error
}

func New

func New(repo string, cfg interface{}) (Linker, error)

func New2

func New2(ctx context.Context, cfg *config.Config, node *core.IpfsNode) Linker

type PeerCache

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

func NewAddress

func NewAddress(cfg *config.Config, node *core.IpfsNode) *PeerCache

func (*PeerCache) AddPeerAddress

func (c *PeerCache) AddPeerAddress(addr peer.AddrInfo) (b bool)

func (*PeerCache) CheckPeerAddress

func (c *PeerCache) CheckPeerAddress(id peer.ID) (b bool)

func (*PeerCache) GetAddress

func (c *PeerCache) GetAddress(id peer.ID) (ai peer.AddrInfo, b bool)

func (*PeerCache) LoadAddress

func (c *PeerCache) LoadAddress(ctx context.Context) (<-chan peer.AddrInfo, error)

func (*PeerCache) Peers

func (c *PeerCache) Peers() (ids []peer.ID)

func (*PeerCache) SaveAddress

func (c *PeerCache) SaveAddress(ctx context.Context) (err error)

SaveNode ...

func (*PeerCache) UpdatePeerAddress

func (c *PeerCache) UpdatePeerAddress(new peer.AddrInfo) bool

type Pinning

type Pinning interface {
	Get() []string
	Clear()
	AddSync(pin string)
	Add(pin string)
	Set(pins []string)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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