fulamobile

package
v1.14.3 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateEd25519Key added in v0.5.2

func GenerateEd25519Key() ([]byte, error)

GenerateEd25519Key generates a random Ed25519 libp2p private key.

func GenerateEd25519KeyFromString added in v1.0.0

func GenerateEd25519KeyFromString(secret string) ([]byte, error)

Types

type Client added in v0.4.9

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

func NewClient added in v0.4.9

func NewClient(cfg *Config) (*Client, error)

func (*Client) AccountBalance added in v0.8.8

func (c *Client) AccountBalance(account string) ([]byte, error)

AccountBalance requests blox at Config.BloxAddr to get the balance of the account. the addr must be a valid multiaddr that includes peer ID.

func (*Client) AccountCreate added in v0.8.8

func (c *Client) AccountCreate() ([]byte, error)

AccountCreate requests blox at Config.BloxAddr to create a account.

func (*Client) AccountExists added in v0.8.8

func (c *Client) AccountExists(account string) ([]byte, error)

AccountExists requests blox at Config.BloxAddr to check if the account exists or not. the addr must be a valid multiaddr that includes peer ID.

func (*Client) AccountFund added in v0.8.8

func (c *Client) AccountFund(seed string, amount blockchain.BigInt, to string) ([]byte, error)

AccountFund requests blox at Config.BloxAddr to fund the account. the addr must be a valid multiaddr that includes peer ID. TODO: This still needs rethink as someone should not be able to put another person PeerID in request

func (*Client) BloxFreeSpace added in v0.8.8

func (c *Client) BloxFreeSpace() ([]byte, error)

BloxFreeSpace requests the blox avail/used free space information.

func (*Client) ConnectToBlox added in v0.8.0

func (c *Client) ConnectToBlox() error

ConnectToBlox attempts to connect to blox via the configured address. This function can be used to check if blox is currently accessible.

func (*Client) DeleteFulaConfig added in v1.14.0

func (c *Client) DeleteFulaConfig() ([]byte, error)

DeleteFulaConfig deletes config.yaml file

func (*Client) Flush added in v0.8.1

func (c *Client) Flush() error

Flush guarantees that all values stored locally are synced to the baking local storage.

func (*Client) Get added in v0.4.9

func (c *Client) Get(key []byte) ([]byte, error)

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

func (c *Client) Has(key []byte) (bool, error)

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) ID added in v0.5.0

func (c *Client) ID() string

ID returns the libp2p peer ID of the client.

func (*Client) ListFailedPushes added in v0.5.9

func (c *Client) ListFailedPushes() (*LinkIterator, error)

func (*Client) ListFailedPushesAsString added in v1.0.0

func (c *Client) ListFailedPushesAsString() (*StringIterator, error)

func (*Client) ManifestAvailable added in v0.8.8

func (c *Client) ManifestAvailable(poolID int) ([]byte, error)

ManifestAvailable requests blox at Config.BloxAddr to list manifests the addr must be a valid multiaddr that includes peer ID.

func (*Client) ManifestRemove added in v0.8.8

func (c *Client) ManifestRemove(seed string, poolID int, cid string) ([]byte, error)

ManifestRemove requests blox at Config.BloxAddr to remove a manifest the addr must be a valid multiaddr that includes peer ID.

func (*Client) ManifestRemoveStored added in v0.8.8

func (c *Client) ManifestRemoveStored(seed string, uploader string, poolID int, cid string) ([]byte, error)

The storer can stop storing a given manifest the addr must be a valid multiaddr that includes peer ID.

func (*Client) ManifestRemoveStorer added in v0.8.8

func (c *Client) ManifestRemoveStorer(seed string, storage string, poolID int, cid string) ([]byte, error)

The uploader or admin can remove an account that is storing a given manifest. the addr must be a valid multiaddr that includes peer ID.

func (*Client) ManifestStore added in v0.8.8

func (c *Client) ManifestStore(seed string, poolID int, uploader string, cid string) ([]byte, error)

ManifestStore requests blox at Config.BloxAddr to store a manifest(store request) the addr must be a valid multiaddr that includes peer ID.

func (*Client) ManifestUpload added in v0.8.8

func (c *Client) ManifestUpload(seed string, poolID int, ReplicationFactor int, uri string) ([]byte, error)

ManifestUpload requests blox at Config.BloxAddr to add a manifest(upload request) the addr must be a valid multiaddr that includes peer ID.

func (*Client) Partition added in v1.14.0

func (c *Client) Partition() ([]byte, error)

Partition requests the blox to partition ssd and nvme

func (*Client) PoolCancelJoin added in v0.8.8

func (c *Client) PoolCancelJoin(seed string, poolID int) ([]byte, error)

PoolJoin requests blox at Config.BloxAddr to cancel a join request for a pool with the id. the addr must be a valid multiaddr that includes peer ID. Note that this call is only allowed on a user's own blox TODO: This still needs rethink as someone should not be able to put another person PeerID in request

func (*Client) PoolCreate added in v0.8.8

func (c *Client) PoolCreate(seed string, poolName string) ([]byte, error)

PoolCreate requests blox at Config.BloxAddr to creates a pool with the name. the addr must be a valid multiaddr that includes peer ID. Note that this call is only allowed on a user's own blox TODO: This still needs rethink as someone should not be able to put another person PeerID in request

func (*Client) PoolJoin added in v0.8.8

func (c *Client) PoolJoin(seed string, poolID int) ([]byte, error)

PoolJoin requests blox at Config.BloxAddr to join a pool with the id. the addr must be a valid multiaddr that includes peer ID. Note that this call is only allowed on a user's own blox TODO: This still needs rethink as someone should not be able to put another person PeerID in request

func (*Client) PoolLeave added in v0.8.8

func (c *Client) PoolLeave(seed string, poolID int) ([]byte, error)

PoolLeave requests blox at Config.BloxAddr to leave a pool with the id. the addr must be a valid multiaddr that includes peer ID. Note that this call is only allowed on a user's own blox TODO: This still needs rethink as someone should not be able to put another person PeerID in request

func (*Client) PoolList added in v0.8.8

func (c *Client) PoolList() ([]byte, error)

PoolList requests blox at Config.BloxAddr to list the pools. the addr must be a valid multiaddr that includes peer ID.

func (*Client) PoolRequests added in v0.8.8

func (c *Client) PoolRequests(poolID int) ([]byte, error)

PoolListRequests requests blox at Config.BloxAddr to list the join request for a pool with the id. the addr must be a valid multiaddr that includes peer ID.

func (*Client) PoolUserList added in v0.8.8

func (c *Client) PoolUserList(poolID int) ([]byte, error)

PoolUserList requests blox at Config.BloxAddr to list the input pool users. the addr must be a valid multiaddr that includes peer ID.

func (*Client) PoolVote added in v0.8.8

func (c *Client) PoolVote(seed string, poolID int, account string, voteValue bool) ([]byte, error)

PoolVote requests blox at Config.BloxAddr to vote for a join request. the addr must be a valid multiaddr that includes peer ID. Note that this call is only allowed on a user's own blox TODO: This still needs rethink as someone should not be able to put another person PeerID in request

func (*Client) Pull added in v0.4.9

func (c *Client) Pull(key []byte) error

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

func (c *Client) Push(key []byte) error

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

func (c *Client) Put(value []byte, codec int64) ([]byte, error)

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) Reboot added in v1.0.0

func (c *Client) Reboot() ([]byte, error)

Reboot requests the blox to reboot

func (*Client) RetryFailedPushes added in v0.8.1

func (c *Client) RetryFailedPushes() error

RetryFailedPushes retries pushing all links that failed to push. The retry is disrupted as soon as a failure occurs. See ListFailedPushes.

func (*Client) Seeded added in v0.8.8

func (c *Client) Seeded(seed string) ([]byte, error)

Seeded requests blox at Config.BloxAddr to create a seeded account. The seed must start with "/", and the addr must be a valid multiaddr that includes peer ID.

func (*Client) SetAuth added in v0.8.3

func (c *Client) SetAuth(on string, subject string, allow bool) error

SetAuth sets authorization on the given peer ID for the given subject.

func (*Client) Shutdown added in v0.4.9

func (c *Client) Shutdown() error

Shutdown closes all resources used by Client. After calling this function Client must be discarded.

func (*Client) WifiRemoveall added in v1.0.0

func (c *Client) WifiRemoveall() ([]byte, error)

WifiRemoveall requests the blox to remove all saved wifis

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
}

func NewConfig added in v0.8.4

func NewConfig() *Config

NewConfig instantiates a new Config with default values.

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)

type StringIterator added in v1.0.0

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

func (*StringIterator) HasNext added in v1.0.0

func (i *StringIterator) HasNext() bool

func (*StringIterator) Next added in v1.0.0

func (i *StringIterator) Next() (string, error)

Jump to

Keyboard shortcuts

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