Documentation
¶
Index ¶
- func GenerateEd25519Key() ([]byte, error)
- type Client
- func (c *Client) ConnectToBlox() error
- func (c *Client) Flush() error
- func (c *Client) Get(key []byte) ([]byte, error)
- func (c *Client) Has(key []byte) (bool, error)
- func (c *Client) ID() string
- func (c *Client) ListFailedPushes() (*LinkIterator, error)
- func (c *Client) Pull(key []byte) error
- func (c *Client) Push(key []byte) error
- func (c *Client) Put(value []byte, codec int64) ([]byte, error)
- func (c *Client) RetryFailedPushes() error
- func (c *Client) SetAuth(on string, subject string, allow bool) error
- func (c *Client) Shutdown() error
- type Config
- type LinkIterator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateEd25519Key ¶ added in v0.5.2
GenerateEd25519Key generates a random Ed25519 libp2p private key.
Types ¶
type Client ¶ added in v0.4.9
type Client struct {
// contains filtered or unexported fields
}
func (*Client) ConnectToBlox ¶ added in v0.8.0
ConnectToBlox attempts to connect to blox via the configured address. This function can be used to check if blox is currently accessible.
func (*Client) Flush ¶ added in v0.8.1
Flush guarantees that all values stored locally are synced to the baking local storage.
func (*Client) Get ¶ added in v0.4.9
Get gets the value corresponding to the given key from the local ipld.LinkSystem The key must be a valid ipld.Link and the value returned is encoded ipld.Node. If data is not found locally, an attempt is made to automatically fetch the data from blox at Config.BloxAddr address.
func (*Client) Has ¶ added in v0.4.9
Has checks whether the value corresponding to the given key is present in the local datastore. The key must be a valid ipld.Link.
func (*Client) ListFailedPushes ¶ added in v0.5.9
func (c *Client) ListFailedPushes() (*LinkIterator, error)
func (*Client) Pull ¶ added in v0.4.9
Pull downloads the data corresponding to the given key from blox at Config.BloxAddr. The key must be a valid ipld.Link.
func (*Client) Push ¶ added in v0.4.9
Push requests blox at Config.BloxAddr to download the given key from this node. The key must be a valid ipld.Link, and the addr must be a valid multiaddr that includes peer ID. The value corresponding to the given key must be stored in the local datastore prior to calling this function. See: Client.Put.
func (*Client) Put ¶ added in v0.4.9
Put stores the given value onto the ipld.LinkSystem and returns its corresponding link. The value is decoded using the decoder that corresponds to the given codec. Therefore, the given value must be a valid ipld.Node. Upon successful local storage of the given value, it is automatically pushed to the blox at Config.BloxAddr address.
func (*Client) RetryFailedPushes ¶ added in v0.8.1
RetryFailedPushes retries pushing all links that failed to push. The retry is disrupted as soon as a failure occurs. See ListFailedPushes.
type Config ¶ added in v0.4.9
type Config struct {
Identity []byte
StorePath string
// Exchange specifies the DAG exchange protocol for Fula mobile client. If left unspecified,
// The default FxExchange protocol is used which will attempt to make remote connections
// when links are stored and retrieved.
//
// For testing purposes, the value may be set to `noop`, in which case, no remote connections
// will be made and the requested exchange is simply logged. When the value is set to `noop`
// the BloxAddr may also be left empty.
Exchange string
BloxAddr string
// StaticRelays specifies a list of static relays used by libp2p auto-relay.
// Defaults to fx.land managed relay if unspecified.
StaticRelays []string
// ForceReachabilityPrivate configures weather the libp2p should always think that it is behind
// NAT.
ForceReachabilityPrivate bool
// SyncWrites assures that writes to the local datastore are flushed to the backing store as
// soon as they are written. By default, writes are not synchronized to disk until either the
// client is shut down or Client.Flush is explicitly called.
SyncWrites bool
// AllowTransientConnection allows transient connectivity via relay when direct connection is
// not possible. Defaults to enabled if unspecified.
AllowTransientConnection bool
}
type LinkIterator ¶ added in v0.8.0
type LinkIterator struct {
// contains filtered or unexported fields
}
func (*LinkIterator) HasNext ¶ added in v0.8.0
func (i *LinkIterator) HasNext() bool
func (*LinkIterator) Next ¶ added in v0.8.0
func (i *LinkIterator) Next() ([]byte, error)