Version: v0.0.0-...-eeaf01f Latest Latest

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

Go to latest
Published: Sep 13, 2021 License: GPL-2.0 Imports: 4 Imported by: 2



checkpoint creates CheckpointIO which provides various operations with checkpoints.



This section is empty.


View Source
var MAIN = []byte("main")

MAIN is key name for all parameters


func LoadData

func LoadData(db *bolt.DB, key []byte) ([]byte, error)

LoadData loads data from bolt database.

func SaveData

func SaveData(db *bolt.DB, key []byte, data []byte) error

SaveData saves values in bolt database.


type CheckpointData

type CheckpointData struct {
	Parameters map[string]float64
	Likelihood float64
	Iter       int
	Final      bool

CheckpointData stores checkpoint data.

type CheckpointIO

type CheckpointIO struct {
	// contains filtered or unexported fields

CheckpointSaver saves checkpoints.

func NewCheckpointIO

func NewCheckpointIO(db *bolt.DB, key []byte, seconds float64) (s *CheckpointIO)

NewCheckpointIO creates a new CheckpointIO.

func (*CheckpointIO) GetParameters

func (s *CheckpointIO) GetParameters() (*CheckpointData, error)

GetParameters returns map with parameter values from checkpoint.

func (*CheckpointIO) Old

func (s *CheckpointIO) Old() bool

Old returns true if last checkpoint save time too long ago.

func (*CheckpointIO) Save

func (s *CheckpointIO) Save(data *CheckpointData) error

Save saves checkpoint to the database given all the values needed.

func (*CheckpointIO) SetNow

func (s *CheckpointIO) SetNow()

SetNow sets last checkpoint time to now.

type PseudoObject

type PseudoObject struct {
	// contains filtered or unexported fields

PseudoObject is a type which can be used to replace objects with their JSON representation for future export.

func NewPseudoObject

func NewPseudoObject(data []byte) *PseudoObject

NewPseudoObject creates a new PseudoObject from byte slice.

func (*PseudoObject) MarshalJSON

func (p *PseudoObject) MarshalJSON() ([]byte, error)

MarshalJSON creates a JSON representation from contents. This is needed for json.Marshal of parent object.

func (*PseudoObject) SelfOrNil

func (p *PseudoObject) SelfOrNil() interface{}

Returns nil if contents is empty, self otherwise

func (*PseudoObject) UnmarshalJSON

func (p *PseudoObject) UnmarshalJSON(b []byte) error

UnmarshalJSON saves bytes contents internally.

Source Files

Jump to

Keyboard shortcuts

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