Documentation ¶
Index ¶
- Constants
- Variables
- func DisableLog()
- func UseLogger(logger logpkg.Logger)
- type AccountCache
- func (c *AccountCache) AccountHashKey(a *model.Account) uint64
- func (c *AccountCache) Add(a *model.Account)
- func (c *AccountCache) AddressHashKey(a tezos.Address) uint64
- func (c *AccountCache) Drop(a *model.Account)
- func (c *AccountCache) GetAddress(addr tezos.Address) (uint64, *model.Account, bool)
- func (c *AccountCache) GetId(id model.AccountID) (uint64, *model.Account, bool)
- func (c *AccountCache) Purge()
- func (c AccountCache) Stats() Stats
- func (c *AccountCache) Walk(fn func(key uint64, acc *model.Account) error) error
- type AddressCache
- func (c *AddressCache) Build(ctx context.Context, table *pack.Table) error
- func (c AddressCache) Cap() int
- func (c *AddressCache) GetAddress(id model.AccountID) tezos.Address
- func (c AddressCache) Len() int
- func (c AddressCache) Size() int
- func (c AddressCache) Stats() Stats
- func (c *AddressCache) Update(accounts map[model.AccountID]*model.Account) error
- type BigmapCache
- type BigmapHistory
- type BigmapHistoryCache
- func (c *BigmapHistoryCache) Build(ctx context.Context, updates *pack.Table, id, height int64) (*BigmapHistory, error)
- func (c *BigmapHistoryCache) Get(id, height int64) (*BigmapHistory, bool)
- func (c *BigmapHistoryCache) GetBest(id, height int64) (*BigmapHistory, bool)
- func (c *BigmapHistoryCache) Purge()
- func (c BigmapHistoryCache) Stats() Stats
- func (c *BigmapHistoryCache) Update(ctx context.Context, hist *BigmapHistory, updates *pack.Table, height int64) (*BigmapHistory, error)
- type BlockCache
- func (c *BlockCache) Build(ctx context.Context, table *pack.Table) error
- func (c BlockCache) Cap() int
- func (c *BlockCache) GetHash(height int64) tezos.BlockHash
- func (c *BlockCache) GetHeight(tm time.Time) int64
- func (c *BlockCache) GetTime(height int64) time.Time
- func (c BlockCache) Len() int
- func (c BlockCache) Size() int
- func (c BlockCache) Stats() Stats
- func (c *BlockCache) Update(block *model.Block) error
- type ByRichRank
- type ByTrafficRank
- type ByVolumeRank
- type ContractCache
- type ContractTypeCache
- type ContractTypeElem
- type ProposalCache
- type RankCache
- func (h *RankCache) Build(ctx context.Context, accounts, ops *pack.Table) error
- func (c RankCache) Cap() int
- func (c *RankCache) Expire() *RankCache
- func (h RankCache) Expired() bool
- func (h *RankCache) GetAccount(id model.AccountID) (*model.AccountRank, bool)
- func (c RankCache) Len() int
- func (c RankCache) Size() int
- func (c RankCache) Stats() Stats
- func (h RankCache) Time() time.Time
- func (h *RankCache) TopRich(n, o int) []*model.AccountRank
- func (h *RankCache) TopTraffic(n, o int) []*model.AccountRank
- func (h *RankCache) TopVolume(n, o int) []*model.AccountRank
- type RightsCache
- func (c *RightsCache) Add(r *model.Right)
- func (c *RightsCache) BitmapSize() int
- func (c *RightsCache) Build(ctx context.Context, startCycle int64, table *pack.Table) error
- func (c RightsCache) Cap() int
- func (c *RightsCache) End() int64
- func (c *RightsCache) Len() int64
- func (c *RightsCache) Lookup(id model.AccountID, height int64) (int64, int64)
- func (c RightsCache) Size() int
- func (c *RightsCache) Start() int64
- func (c RightsCache) Stats() Stats
- type Stats
- type TicketCache
Constants ¶
View Source
const (
TicketMaxCacheSize = 16384 // entries
)
Variables ¶
View Source
var ( BigmapHistoryMaxCacheSize = 2048 // full bigmaps (all keys + values) BigmapMaxCacheSize = 1 << 20 // 1M entries )
View Source
var ( ContractMaxCacheSize = 16384 // entries ContractTypeMaxCacheSize = 16384 // entries )
View Source
var AccountCacheSizeMaxSize = 16384 // entries
Functions ¶
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.
Types ¶
type AccountCache ¶
type AccountCache struct {
// contains filtered or unexported fields
}
func NewAccountCache ¶
func NewAccountCache(sz int) *AccountCache
func (*AccountCache) AccountHashKey ¶
func (c *AccountCache) AccountHashKey(a *model.Account) uint64
func (*AccountCache) Add ¶
func (c *AccountCache) Add(a *model.Account)
func (*AccountCache) AddressHashKey ¶
func (c *AccountCache) AddressHashKey(a tezos.Address) uint64
func (*AccountCache) Drop ¶
func (c *AccountCache) Drop(a *model.Account)
func (*AccountCache) GetAddress ¶
func (*AccountCache) Purge ¶
func (c *AccountCache) Purge()
func (AccountCache) Stats ¶
func (c AccountCache) Stats() Stats
type AddressCache ¶
type AddressCache struct {
// contains filtered or unexported fields
}
a cache of on-chain addresses id->hash
func NewAddressCache ¶
func NewAddressCache(size int) *AddressCache
func (AddressCache) Cap ¶
func (c AddressCache) Cap() int
func (*AddressCache) GetAddress ¶
func (c *AddressCache) GetAddress(id model.AccountID) tezos.Address
func (AddressCache) Len ¶
func (c AddressCache) Len() int
func (AddressCache) Size ¶
func (c AddressCache) Size() int
func (AddressCache) Stats ¶
func (c AddressCache) Stats() Stats
type BigmapCache ¶
type BigmapCache struct {
// contains filtered or unexported fields
}
func NewBigmapCache ¶
func NewBigmapCache(sz int) *BigmapCache
func (*BigmapCache) Add ¶
func (c *BigmapCache) Add(b *model.BigmapAlloc)
func (*BigmapCache) Drop ¶
func (c *BigmapCache) Drop(b *model.BigmapAlloc)
func (*BigmapCache) GetType ¶
func (c *BigmapCache) GetType(id int64) (*model.BigmapAlloc, bool)
func (*BigmapCache) Purge ¶
func (c *BigmapCache) Purge()
func (BigmapCache) Stats ¶
func (c BigmapCache) Stats() Stats
type BigmapHistory ¶
type BigmapHistory struct { BigmapId int64 Height int64 KeyOffsets []uint32 ValueOffsets []uint32 Data []byte }
func (BigmapHistory) Get ¶
func (h BigmapHistory) Get(key tezos.ExprHash) *model.BigmapValue
func (BigmapHistory) Len ¶
func (h BigmapHistory) Len() int
func (BigmapHistory) Range ¶
func (h BigmapHistory) Range(from, to int) []*model.BigmapValue
func (BigmapHistory) Size ¶
func (h BigmapHistory) Size() int64
type BigmapHistoryCache ¶
type BigmapHistoryCache struct {
// contains filtered or unexported fields
}
func NewBigmapHistoryCache ¶
func NewBigmapHistoryCache(sz int) *BigmapHistoryCache
func (*BigmapHistoryCache) Build ¶
func (c *BigmapHistoryCache) Build(ctx context.Context, updates *pack.Table, id, height int64) (*BigmapHistory, error)
func (*BigmapHistoryCache) Get ¶
func (c *BigmapHistoryCache) Get(id, height int64) (*BigmapHistory, bool)
func (*BigmapHistoryCache) GetBest ¶
func (c *BigmapHistoryCache) GetBest(id, height int64) (*BigmapHistory, bool)
func (*BigmapHistoryCache) Purge ¶
func (c *BigmapHistoryCache) Purge()
func (BigmapHistoryCache) Stats ¶
func (c BigmapHistoryCache) Stats() Stats
func (*BigmapHistoryCache) Update ¶
func (c *BigmapHistoryCache) Update(ctx context.Context, hist *BigmapHistory, updates *pack.Table, height int64) (*BigmapHistory, error)
type BlockCache ¶
type BlockCache struct {
// contains filtered or unexported fields
}
NOTE: simple read-mostly cache for timestamps and block hashes
Timestamps
- 4-8 MB (2021)
- block height ->> unix seconds (uint32)
- first timestamp is actual time in unix secs, remainder are offsets in seconds
- each entry uses 4 bytes per block, safe until June 2017 + 66 years; by then Tezos may have reached 34M blocks and the cache is 132MB in size
Block hashes - 32 byte per hash, growth rate is 16MB per year
func NewBlockCache ¶
func NewBlockCache(size int) *BlockCache
func (BlockCache) Cap ¶
func (c BlockCache) Cap() int
func (BlockCache) Len ¶
func (c BlockCache) Len() int
func (BlockCache) Size ¶
func (c BlockCache) Size() int
func (BlockCache) Stats ¶
func (c BlockCache) Stats() Stats
type ByRichRank ¶
type ByRichRank []*model.AccountRank
func (ByRichRank) Len ¶
func (h ByRichRank) Len() int
func (ByRichRank) Less ¶
func (h ByRichRank) Less(i, j int) bool
func (ByRichRank) Swap ¶
func (h ByRichRank) Swap(i, j int)
type ByTrafficRank ¶
type ByTrafficRank []*model.AccountRank
func (ByTrafficRank) Len ¶
func (h ByTrafficRank) Len() int
func (ByTrafficRank) Less ¶
func (h ByTrafficRank) Less(i, j int) bool
func (ByTrafficRank) Swap ¶
func (h ByTrafficRank) Swap(i, j int)
type ByVolumeRank ¶
type ByVolumeRank []*model.AccountRank
func (ByVolumeRank) Len ¶
func (h ByVolumeRank) Len() int
func (ByVolumeRank) Less ¶
func (h ByVolumeRank) Less(i, j int) bool
func (ByVolumeRank) Swap ¶
func (h ByVolumeRank) Swap(i, j int)
type ContractCache ¶
type ContractCache struct {
// contains filtered or unexported fields
}
func NewContractCache ¶
func NewContractCache(sz int) *ContractCache
func (*ContractCache) Add ¶
func (c *ContractCache) Add(cc *model.Contract)
func (*ContractCache) Drop ¶
func (c *ContractCache) Drop(cc *model.Contract)
func (*ContractCache) Purge ¶
func (c *ContractCache) Purge()
func (ContractCache) Size ¶
func (c ContractCache) Size() int64
func (ContractCache) Stats ¶
func (c ContractCache) Stats() Stats
type ContractTypeCache ¶
type ContractTypeCache struct {
// contains filtered or unexported fields
}
func NewContractTypeCache ¶
func NewContractTypeCache(sz int) *ContractTypeCache
func (*ContractTypeCache) Add ¶
func (c *ContractTypeCache) Add(cc *model.Contract) *ContractTypeElem
func (*ContractTypeCache) Drop ¶
func (c *ContractTypeCache) Drop(cc *model.Contract)
func (*ContractTypeCache) Get ¶
func (c *ContractTypeCache) Get(id model.AccountID) (*ContractTypeElem, bool)
func (*ContractTypeCache) Purge ¶
func (c *ContractTypeCache) Purge()
func (ContractTypeCache) Stats ¶
func (c ContractTypeCache) Stats() Stats
type ContractTypeElem ¶
type ContractTypeElem struct { ParamType micheline.Type StorageType micheline.Type CodeHash uint64 }
func (ContractTypeElem) Size ¶
func (e ContractTypeElem) Size() int64
type ProposalCache ¶
type ProposalCache struct {
// contains filtered or unexported fields
}
a cache of on-chain addresses id->hash
func NewProposalCache ¶
func NewProposalCache() *ProposalCache
func (*ProposalCache) GetHash ¶
func (c *ProposalCache) GetHash(id model.ProposalID) tezos.ProtocolHash
func (ProposalCache) Len ¶
func (c ProposalCache) Len() int
func (ProposalCache) Size ¶
func (c ProposalCache) Size() int
func (ProposalCache) Stats ¶
func (c ProposalCache) Stats() Stats
type RankCache ¶
type RankCache struct {
// contains filtered or unexported fields
}
func NewRankCache ¶
func NewRankCache() *RankCache
func (*RankCache) GetAccount ¶
func (*RankCache) TopTraffic ¶
func (h *RankCache) TopTraffic(n, o int) []*model.AccountRank
type RightsCache ¶
type RightsCache struct {
// contains filtered or unexported fields
}
caches rights for up to 6 cycles (current + future preserved_cycles) for fast lookup of next right by account id + current height for about 500 active bakers that is - 2 * ((1024 byte per cycle * 6 cycles) + const slice+map overhead 48b) * 500 = 6MB
func NewRightsCache ¶
func NewRightsCache(blocksPerCycle, numCycles int64, startHeight, startCycle int64) *RightsCache
func (*RightsCache) Add ¶
func (c *RightsCache) Add(r *model.Right)
func (*RightsCache) BitmapSize ¶
func (c *RightsCache) BitmapSize() int
func (RightsCache) Cap ¶
func (c RightsCache) Cap() int
func (*RightsCache) End ¶
func (c *RightsCache) End() int64
func (*RightsCache) Len ¶
func (c *RightsCache) Len() int64
func (RightsCache) Size ¶
func (c RightsCache) Size() int
func (*RightsCache) Start ¶
func (c *RightsCache) Start() int64
func (RightsCache) Stats ¶
func (c RightsCache) Stats() Stats
type Stats ¶
type Stats struct { Size int `json:"size"` Bytes int64 `json:"bytes"` Inserts int64 `json:"inserts"` Updates int64 `json:"updates"` Hits int64 `json:"hits"` Misses int64 `json:"misses"` Evictions int64 `json:"evictions"` }
func (*Stats) CountEvictions ¶
func (*Stats) CountInserts ¶
func (*Stats) CountMisses ¶
func (*Stats) CountUpdates ¶
type TicketCache ¶
type TicketCache struct {
// contains filtered or unexported fields
}
func NewTicketCache ¶
func NewTicketCache(sz int) *TicketCache
func (*TicketCache) Add ¶
func (c *TicketCache) Add(t *model.Ticket)
func (*TicketCache) Drop ¶
func (c *TicketCache) Drop(t *model.Ticket)
func (*TicketCache) Purge ¶
func (c *TicketCache) Purge()
func (TicketCache) Stats ¶
func (c TicketCache) Stats() Stats
Click to show internal directories.
Click to hide internal directories.