mongo

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDBName   = "iota_account"
	DefaultCollName = "accounts"

	DepositAddressesKey = "deposit_addresses"
	KeyIndexKey         = "key_index"
	PendingTransfersKey = "pending_transfers"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// The name of the database inside MongoDB.
	DBName string
	// The name of the collection in which to store accounts.
	CollName string
	// The context provider which gets called up on each MongoDB call
	// in order to determine the timeout/cancellation.
	ContextProvider ContextProviderFunc
}

Config defines settings which are used in conjunction with MongoDB.

type ContextProviderFunc

type ContextProviderFunc func() context.Context

ContextProviderFunc which generates a new context.

type MongoStore

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

func NewMongoStore

func NewMongoStore(uri string, cnf *Config, opts ...*options.ClientOptions) (*MongoStore, error)

NewMongoStore creates a new MongoDB store. If no MongoDB client options are defined, the client will be configured with a majority read/write concern, 5 sec. write concern timeout and journal write acknowledgement.

func (*MongoStore) AddDepositAddress

func (ms *MongoStore) AddDepositAddress(id string, index uint64, depositAddress *store.StoredDepositAddress) error

func (*MongoStore) AddPendingTransfer

func (ms *MongoStore) AddPendingTransfer(id string, originTailTxHash trinary.Hash, bundleTrytes []trinary.Trytes, indices ...uint64) error

func (*MongoStore) AddTailHash

func (ms *MongoStore) AddTailHash(id string, originTailTxHash trinary.Hash, newTailTxHash trinary.Hash) error

func (*MongoStore) ExportAccount

func (ms *MongoStore) ExportAccount(id string) (*store.ExportedAccountState, error)

func (*MongoStore) GetDepositAddresses

func (ms *MongoStore) GetDepositAddresses(id string) (map[uint64]*store.StoredDepositAddress, error)

func (*MongoStore) GetPendingTransfers

func (ms *MongoStore) GetPendingTransfers(id string) (map[string]*store.PendingTransfer, error)

func (*MongoStore) ImportAccount

func (ms *MongoStore) ImportAccount(state store.ExportedAccountState) error

func (*MongoStore) LoadAccount

func (ms *MongoStore) LoadAccount(id string) (*store.AccountState, error)

func (*MongoStore) ReadIndex

func (ms *MongoStore) ReadIndex(id string) (uint64, error)

func (*MongoStore) RemoveAccount

func (ms *MongoStore) RemoveAccount(id string) error

func (*MongoStore) RemoveDepositAddress

func (ms *MongoStore) RemoveDepositAddress(id string, index uint64) error

func (*MongoStore) RemovePendingTransfer

func (ms *MongoStore) RemovePendingTransfer(id string, originTailTxHash trinary.Hash) error

func (*MongoStore) WriteIndex

func (ms *MongoStore) WriteIndex(id string, index uint64) error

Jump to

Keyboard shortcuts

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