Documentation ¶
Overview ¶
checkpoint creates CheckpointIO which provides various operations with checkpoints.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var MAIN = []byte("main")
MAIN is key name for all parameters
Functions ¶
Types ¶
type CheckpointData ¶
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.