mem

package
v0.0.0-...-7838e69 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 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

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

func (s *Service) AddAccount(ctx 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(ctx 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

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

FetchAccounts fetches all accounts for the wallet.

func (*Service) FetchWallet

func (s *Service) FetchWallet(ctx 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