cache

package
v0.0.4-unstable Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Addr      common.Address `json:"address"` // account address derived from the key.
	Path      string         `json:"path"`    // key json file path.
	PublicKey string         `json:"publicKey"`
}

Account represents an fractal account.

func (Account) Cmp

func (a Account) Cmp(account Account) int

Cmp compares x and y and returns:

-1 if x <  y
 0 if x == y
+1 if x >  y

type AccountCache

type AccountCache struct {
	sync.Mutex
	// contains filtered or unexported fields
}

AccountCache is a live index of all accounts in the keystore.

func NewAccountCache

func NewAccountCache(keydir string) *AccountCache

NewAccountCache creates a account cache.

func (*AccountCache) Accounts

func (ac *AccountCache) Accounts() Accounts

Accounts returns all accounts in cacahe.

func (*AccountCache) Add

func (ac *AccountCache) Add(new Account)

Add add a new acount in cache.

func (*AccountCache) Close

func (ac *AccountCache) Close()

Close close account cache.

func (*AccountCache) Delete

func (ac *AccountCache) Delete(addr common.Address)

Delete delete a account in cache.

func (*AccountCache) Find

func (ac *AccountCache) Find(addr common.Address) *Account

Find find account by address.

func (*AccountCache) Has

func (ac *AccountCache) Has(addr common.Address) bool

Has check whether a key with the given address in cache.

func (*AccountCache) Reload

func (ac *AccountCache) Reload()

Reload reload cache.

type Accounts

type Accounts []Account

Accounts is a Account slice type.

func (Accounts) Len

func (as Accounts) Len() int

func (Accounts) Less

func (as Accounts) Less(i, j int) bool

func (Accounts) Swap

func (as Accounts) Swap(i, j int)

Jump to

Keyboard shortcuts

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