tests

package
v0.2.0-pre.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientConfigMA

func ClientConfigMA() (ma.Multiaddr, string)

ClientConfigMA returns the prepared multiaddress and Lotus token, to connect to a Lotus node.

func CreateLocalDevnet

func CreateLocalDevnet(t *testing.T, numMiners int) (*apistruct.FullNodeStruct, address.Address, []address.Address)

CreateLocalDevnet returns an API client that targets a local devnet with numMiners number of miners. Refer to http://github.com/textileio/local-devnet for more information.

func CreateLocalDevnetWithIPFS

func CreateLocalDevnetWithIPFS(t *testing.T, numMiners int, ipfsMaddr string, mountVolumes bool) (*apistruct.FullNodeStruct, address.Address, []address.Address)

CreateLocalDevnetWithIPFS creates a local devnet connected to an IPFS node.

func GetLotusToken

func GetLotusToken(lotusFolderPath string) (string, error)

GetLotusToken returns the lotus token from a Lotus repo path.

func LaunchDevnetDocker

func LaunchDevnetDocker(t *testing.T, numMiners int, ipfsMaddr string, mountVolumes bool) *dockertest.Resource

LaunchDevnetDocker launches the devnet docker image.

func LaunchIPFSDocker

func LaunchIPFSDocker() (*dockertest.Resource, func())

LaunchIPFSDocker runs a fresh go-ipfs docker image and returns the resource for container metadata.

func NewSimpleTx

func NewSimpleTx(ds datastore.Datastore) datastore.Txn

NewSimpleTx creates a transaction.

Types

type SimpleTx

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

SimpleTx implements the transaction interface for datastores who do not have any sort of underlying transactional support.

func (*SimpleTx) Commit

func (bt *SimpleTx) Commit() error

Commit confirms changes done in the transaction.

func (*SimpleTx) Delete

func (bt *SimpleTx) Delete(key datastore.Key) error

Delete deletes a key.

func (*SimpleTx) Discard

func (bt *SimpleTx) Discard()

Discard cancels the changes done in the transaction.

func (*SimpleTx) Get

func (bt *SimpleTx) Get(k datastore.Key) ([]byte, error)

Get returns a key value within the transaction.

func (*SimpleTx) GetSize

func (bt *SimpleTx) GetSize(k datastore.Key) (int, error)

GetSize returns the size of the key value.

func (*SimpleTx) Has

func (bt *SimpleTx) Has(k datastore.Key) (bool, error)

Has returns true if the key exist, false otherwise.

func (*SimpleTx) Put

func (bt *SimpleTx) Put(key datastore.Key, val []byte) error

Put sets the value for a key.

func (*SimpleTx) Query

func (bt *SimpleTx) Query(q query.Query) (query.Results, error)

Query executes a query within the transaction scope.

type TxMapDatastore

type TxMapDatastore struct {
	*datastore.MapDatastore
	// contains filtered or unexported fields
}

TxMapDatastore is a in-memory datastore that satisfies TxnDatastore.

func NewTxMapDatastore

func NewTxMapDatastore() *TxMapDatastore

NewTxMapDatastore returns a new TxMapDatastore.

func (*TxMapDatastore) Clone

func (d *TxMapDatastore) Clone() (*TxMapDatastore, error)

Clone returns a cloned datastore.

func (*TxMapDatastore) Delete

func (d *TxMapDatastore) Delete(key datastore.Key) error

Delete deletes a key.

func (*TxMapDatastore) Get

func (d *TxMapDatastore) Get(key datastore.Key) ([]byte, error)

Get returns the value for a key.

func (*TxMapDatastore) NewTransaction

func (d *TxMapDatastore) NewTransaction(readOnly bool) (datastore.Txn, error)

NewTransaction creates a transaction A read-only transaction should be indicated with readOnly equal true.

func (*TxMapDatastore) Put

func (d *TxMapDatastore) Put(key datastore.Key, data []byte) error

Put sets the value of a key.

func (*TxMapDatastore) Query

func (d *TxMapDatastore) Query(q query.Query) (query.Results, error)

Query executes a query in the datastore.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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