util

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: Apache-2.0 Imports: 7 Imported by: 11

Documentation

Index

Constants

View Source
const DefaultFileCallbackId = ""

Variables

View Source
var (
	MarshalJSON   = json.Marshal
	UnmarshalJSON = json.Unmarshal
)

Should only be overwritten during process init()'ialization.

View Source
var (
	// Bolt keys
	BoltSnapshotsBucket           = []byte{'s'}
	BoltTrainerKey                = []byte{'t'}
	BoltTrainCompleteKey          = []byte{'c'}
	BoltTrainedSamplesKey         = []byte{'n'}
	BoltPathKey                   = []byte{'p'}
	BoltDeletedKey                = []byte{'d'}
	BoltInternalKey               = []byte{'i'}
	BoltMetaDataKey               = []byte{'m'}
	BoltMetaDataSegmentTypeKey    = []byte("type")
	BoltMetaDataSegmentVersionKey = []byte("version")
	BoltMetaDataTimeStamp         = []byte("timeStamp")
	BoltStatsKey                  = []byte("stats")
	BoltUpdatedFieldsKey          = []byte("fields")
	TotBytesWrittenKey            = []byte("TotBytesWritten")
	BoltMetaDataFileWriterIDKey   = []byte("fileWriterID")

	MappingInternalKey = []byte("_mapping")
)

Functions

func ExtractNumericValFloat32 added in v2.4.0

func ExtractNumericValFloat32(v interface{}) (float32, bool)

extract numeric value (if possible) and returns a float32

func ExtractNumericValFloat64 added in v2.4.0

func ExtractNumericValFloat64(v interface{}) (float64, bool)

extract numeric value (if possible) and returns a float64

func IsValidFloat32 added in v2.4.1

func IsValidFloat32(val float64) bool

Types

type BoltBucketImpl added in v2.6.0

type BoltBucketImpl struct {
	*bolt.Bucket
	// contains filtered or unexported fields
}

wrapper around bolt.Bucket

func (*BoltBucketImpl) CreateBucketIfNotExists added in v2.6.0

func (b *BoltBucketImpl) CreateBucketIfNotExists(name []byte) (*BoltBucketImpl, error)

func (*BoltBucketImpl) ForEach added in v2.6.0

func (b *BoltBucketImpl) ForEach(fn func(key []byte, value []byte) error, reader FileReader) error

Process values during ForEach if the bucket name or key is in the boltKeysProcessed map

func (*BoltBucketImpl) Get added in v2.6.0

func (b *BoltBucketImpl) Get(key []byte, reader FileReader) ([]byte, error)

Process values during Put/Get if the bucket name or key is in the boltKeysProcessed map

func (*BoltBucketImpl) GetBucket added in v2.6.0

func (b *BoltBucketImpl) GetBucket(name []byte) *BoltBucketImpl

func (*BoltBucketImpl) Put added in v2.6.0

func (b *BoltBucketImpl) Put(key []byte, value []byte, writer FileWriter) error

Process values during Put/Get if the bucket name or key is in the boltKeysProcessed map

type BoltTxImpl added in v2.6.0

type BoltTxImpl struct {
	*bolt.Tx
}

wrapper around bolt.Tx

func (*BoltTxImpl) Bucket added in v2.6.0

func (tx *BoltTxImpl) Bucket(name []byte) *BoltBucketImpl

func (*BoltTxImpl) CreateBucketIfNotExists added in v2.6.0

func (tx *BoltTxImpl) CreateBucketIfNotExists(name []byte) (*BoltBucketImpl, error)

type FileReader added in v2.6.0

type FileReader interface {
	Process(data []byte) ([]byte, error)
	Id() string
}

func NewFileReader added in v2.6.0

func NewFileReader(id string, context []byte) (FileReader, error)

type FileWriter added in v2.6.0

type FileWriter interface {
	Process(data []byte) []byte
	Id() string
}

FileWriter and FileReader interfaces are wrappers around the callback functions provided by the user. They provide a convenient way to apply the callbacks to data being written to or read from a file. They also store the id the callbacks, which can be useful for managing state across multiple reads and writes.

func NewFileWriter added in v2.6.0

func NewFileWriter(context []byte) (FileWriter, error)

type RootBoltImpl added in v2.6.0

type RootBoltImpl struct {
	*bolt.DB
}

wrapper around bolt.DB

func OpenBolt added in v2.6.0

func OpenBolt(path string, mode os.FileMode, options *bolt.Options) (*RootBoltImpl, error)

func (*RootBoltImpl) Begin added in v2.6.0

func (r *RootBoltImpl) Begin(writable bool) (*BoltTxImpl, error)

func (*RootBoltImpl) Update added in v2.6.0

func (r *RootBoltImpl) Update(fn func(*BoltTxImpl) error) error

func (*RootBoltImpl) View added in v2.6.0

func (r *RootBoltImpl) View(fn func(*BoltTxImpl) error) error

Jump to

Keyboard shortcuts

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