mem

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Parameter

type Parameter interface {
	// contains filtered or unexported methods
}

Parameter is the interface for service parameters.

func WithEncryptor added in v0.9.0

func WithEncryptor(encryptor e2wtypes.Encryptor) Parameter

WithEncryptor sets the encryptor for this module.

func WithLogLevel

func WithLogLevel(logLevel zerolog.Level) Parameter

WithLogLevel sets the log level for the module.

func WithMonitor

func WithMonitor(monitor metrics.FetcherMonitor) Parameter

WithMonitor sets the monitor for this module.

func WithStores

func WithStores(stores []e2wtypes.Store) Parameter

WithStores sets the stores for this module.

type Service

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

Service contains an in-memory cache of wallets and accounts.

func New

func New(ctx context.Context, params ...Parameter) (*Service, error)

New creates a new in-memory fetcher.

func (*Service) AddAccount added in v1.1.0

func (s *Service) AddAccount(_ context.Context, wallet e2wtypes.Wallet, account e2wtypes.Account) error

AddAccount adds an account to the fetcher's internal stores.

func (*Service) FetchAccount

func (s *Service) FetchAccount(_ context.Context, path string) (e2wtypes.Wallet, e2wtypes.Account, error)

FetchAccount fetches the account given its name.

func (*Service) FetchAccountByKey

func (s *Service) FetchAccountByKey(ctx context.Context, pubKey []byte) (e2wtypes.Wallet, e2wtypes.Account, error)

FetchAccountByKey fetches the account given its public key.

func (*Service) FetchAccounts added in v1.1.0

func (s *Service) FetchAccounts(_ context.Context, path string) (map[string]e2wtypes.Account, error)

FetchAccounts fetches all accounts for the wallet.

func (*Service) FetchWallet

func (s *Service) FetchWallet(_ context.Context, path string) (e2wtypes.Wallet, error)

FetchWallet fetches the wallet.

Jump to

Keyboard shortcuts

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