cache

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileSystem

type FileSystem struct {
	Directory string
}

func NewFileSystem

func NewFileSystem(directory string) (*FileSystem, error)

func (*FileSystem) Block

func (f *FileSystem) Block(hash []byte) (*bcgo.Block, error)

func (*FileSystem) BlockContainingRecord

func (f *FileSystem) BlockContainingRecord(channel string, hash []byte) (*bcgo.Block, error)

func (*FileSystem) BlockEntries

func (f *FileSystem) BlockEntries(channel string, timestamp uint64) ([]*bcgo.BlockEntry, error)

func (*FileSystem) Head

func (f *FileSystem) Head(channel string) (*bcgo.Reference, error)

func (*FileSystem) MeasureStorageUsage

func (f *FileSystem) MeasureStorageUsage(prefix string) (map[string]uint64, error)

func (*FileSystem) PutBlock

func (f *FileSystem) PutBlock(hash []byte, block *bcgo.Block) error

func (*FileSystem) PutBlockEntry

func (f *FileSystem) PutBlockEntry(channel string, entry *bcgo.BlockEntry) error

func (*FileSystem) PutHead

func (f *FileSystem) PutHead(channel string, reference *bcgo.Reference) error

type Memory

type Memory struct {
	Blocks  map[string]*bcgo.Block
	Heads   map[string]*bcgo.Reference
	Entries map[string][]*bcgo.BlockEntry
	Mapping map[string]*bcgo.Block
}

func NewMemory

func NewMemory(size int) *Memory

func (*Memory) Block

func (m *Memory) Block(hash []byte) (*bcgo.Block, error)

func (*Memory) BlockContainingRecord

func (m *Memory) BlockContainingRecord(channel string, hash []byte) (*bcgo.Block, error)

func (*Memory) BlockEntries

func (m *Memory) BlockEntries(channel string, timestamp uint64) ([]*bcgo.BlockEntry, error)

func (*Memory) Head

func (m *Memory) Head(channel string) (*bcgo.Reference, error)

func (*Memory) PutBlock

func (m *Memory) PutBlock(hash []byte, block *bcgo.Block) error

func (*Memory) PutBlockEntry

func (m *Memory) PutBlockEntry(channel string, entry *bcgo.BlockEntry) error

func (*Memory) PutHead

func (m *Memory) PutHead(channel string, reference *bcgo.Reference) error

Jump to

Keyboard shortcuts

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