storage

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileStateMgr

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

FileStateMgr save the local state to file

func (*FileStateMgr) GetLatestWalletState

func (fsm *FileStateMgr) GetLatestWalletState() (WalletLocalState, error)

GetLatestWalletState traverse the folder to find out the latest file

func (*FileStateMgr) GetLocalWalletState

func (fsm *FileStateMgr) GetLocalWalletState(address string) (WalletLocalState, error)

GetLocalWalletState read the local state from file system

func (*FileStateMgr) SaveLocalWalletState

func (fsm *FileStateMgr) SaveLocalWalletState(state WalletLocalState) error

SaveLocalWalletState save the local state to file

type LocalStateManager

type LocalStateManager interface {
	SaveLocalWalletState(state WalletLocalState) error
	GetLocalWalletState(address string) (WalletLocalState, error)
}

LocalStateManager provide necessary methods to manage the local state, save it , and read it back LocalStateManager doesn't have any opinion where it should be persistent to

func NewFileStateMgr

func NewFileStateMgr(folder string) (LocalStateManager, error)

NewFileStateMgr create a new instance of the FileStateMgr which implements LocalStateManager

type LocalStateManagerCreator

type LocalStateManagerCreator func(folder string) (LocalStateManager, error)

LocalStateManagerCreator a function to create a new instance of FileStateMgr

type MockLocalStateManager

type MockLocalStateManager struct {
	mock.Mock
}

MockLocalStateManager mock local state manager

func (*MockLocalStateManager) GetLocalWalletState

func (m *MockLocalStateManager) GetLocalWalletState(address string) (WalletLocalState, error)

func (*MockLocalStateManager) SaveLocalWalletState

func (m *MockLocalStateManager) SaveLocalWalletState(state WalletLocalState) error

type WalletLocalState

type WalletLocalState struct {
	Address         string   `json:"address"`
	WalletName      string   `json:"wallet_name"`
	WalletRPC       string   `json:"wallet_rpc"`
	ParticipantKeys []string `json:"participant_keys"` // the paticipant of last key gen
}

WalletLocalState is a structure used to represent the data we saved locally for different keygen

Jump to

Keyboard shortcuts

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