storage

package
v0.0.0-...-3629ecc Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2019 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyAlreadyExists = errors.New("key already exists in db")
	ErrKeyNotExists     = errors.New("key does not exists in db")
	ErrInconsistentSize = errors.New("inconsistent db and IPFS datasize")
)

Functions

This section is empty.

Types

type GlobalsEntry

type GlobalsEntry struct {
	CurrentQuota uint
}

type HashEntry

type HashEntry struct {
	DataSize uint
	Links    []string
	Mark     bool
	Dirty    bool
}

type MemberEntry

type MemberEntry struct {
	HashCount uint
	DataSize  uint
}

type ResolvesEntry

type ResolvesEntry struct {
	Entries []string
}

type SavePointEntry

type SavePointEntry struct {
	LastBlock    uint64
	LastTxIndex  uint
	LastLogIndex uint
}

type Storage

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

Storage manages the application state

func New

func New(path string) (*Storage, error)

New creates a new storage path.

func (*Storage) AddHash

func (s *Storage) AddHash(hash string, hentry *HashEntry) error

func (*Storage) AddMember

func (s *Storage) AddMember(member string) error

AddContract to the storage.

func (*Storage) DeleteHash

func (s *Storage) DeleteHash(hash string)

func (*Storage) Dump

func (s *Storage) Dump(w io.Writer)

Dump the database content.

func (*Storage) Globals

func (s *Storage) Globals() (*GlobalsEntry, error)

Globals gets the globals from the db.

func (*Storage) Hash

func (s *Storage) Hash(hash string) (*HashEntry, error)

func (*Storage) HashUpdateIter

func (s *Storage) HashUpdateIter(uf UpdateFunc) error

func (*Storage) Member

func (s *Storage) Member(member string) (*MemberEntry, error)

Contract return a new contract.

func (*Storage) Members

func (s *Storage) Members() ([]string, error)

Contracts returns the list of current defined contracts.

func (*Storage) RemoveMember

func (s *Storage) RemoveMember(member string) error

RemoveMember from the storage..

func (*Storage) SetGlobals

func (s *Storage) SetGlobals(globals GlobalsEntry) error

SetGlobals in the storage.

func (*Storage) UpdateHash

func (s *Storage) UpdateHash(hash string, hentry *HashEntry) error

type UpdateFunc

type UpdateFunc func(hash string, entry *HashEntry) *HashEntry

Jump to

Keyboard shortcuts

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