store

package
v0.0.50 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Keys

func Keys(pubKey ed25519.PublicKey, datKey []byte) (uint8, uint64)

func Mass

func Mass(work []byte, t time.Time) float64

Types

type Dat

type Dat struct {
	Key    []byte
	Val    []byte
	Time   time.Time
	Salt   []byte
	Work   []byte
	Sig    []byte
	PubKey ed25519.PublicKey
}

type Store

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

func New

func New(cfg *StoreCfg) (*Store, error)

func (*Store) Count

func (s *Store) Count() uint32

func (*Store) Get

func (s *Store) Get(pubKey ed25519.PublicKey, datKey []byte) (*Dat, bool)

func (*Store) Put

func (s *Store) Put(dat *Dat) (bool, error)

func (*Store) Rand

func (s *Store) Rand(shard uint8) *Dat

type StoreCfg

type StoreCfg struct {
	ShardCap       int
	PruneEvery     time.Duration
	BackupFilename string
	Logger         *logger.Logger
	Kill           <-chan struct{}
	Done           chan<- struct{}
}

Jump to

Keyboard shortcuts

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