Documentation
¶
Index ¶
- Constants
- Variables
- func GenericMapToSubMap(v map[string]interface{}) (map[string]HiveValue, error)
- func HiveDump(data *map[string]HiveValue)
- func HiveMapToGeneric(hive map[string]HiveValue) map[string]interface{}
- func HiveSize(data map[string]HiveValue) uint
- type BinHive
- func (h *BinHive) Characteristics() HiveCharacteristics
- func (h *BinHive) Commit() error
- func (h *BinHive) Delete(key string)
- func (h *BinHive) Get(key string) (interface{}, error)
- func (h *BinHive) GetBool(key string) (bool, error)
- func (h *BinHive) GetData() *map[string]HiveValue
- func (h *BinHive) GetFloat(key string) (float64, error)
- func (h *BinHive) GetInt(key string) (int, error)
- func (h *BinHive) GetString(key string) (*string, error)
- func (h *BinHive) Load() error
- func (h *BinHive) NewSub(key string)
- func (h *BinHive) Save() error
- func (h *BinHive) Set(key string, value interface{}) error
- func (h *BinHive) SetBool(key string, value bool) error
- func (h *BinHive) SetFloat(key string, value float64) error
- func (h *BinHive) SetInt(key string, value int) error
- func (h *BinHive) SetString(key string, value string) error
- type Hive
- type HiveCharacteristics
- type HiveValue
- func (v *HiveValue) Bool() (bool, error)
- func (v *HiveValue) Byte() (byte, error)
- func (v *HiveValue) Bytes() ([]byte, error)
- func (v *HiveValue) Float32() (float32, error)
- func (v *HiveValue) Float64() (float64, error)
- func (v *HiveValue) Int() (int, error)
- func (v *HiveValue) Int64() (int64, error)
- func (v *HiveValue) IsStoredType(t byte) bool
- func (v *HiveValue) Len() uint64
- func (v *HiveValue) String() (string, error)
- func (v *HiveValue) Sub() (map[string]HiveValue, error)
- func (v *HiveValue) Type() byte
- func (v *HiveValue) TypeString() string
- func (v *HiveValue) Uint() (uint, error)
- func (v *HiveValue) Uint64() (uint64, error)
- func (v *HiveValue) Value() interface{}
- type MemHive
- func (h *MemHive) Characteristics() HiveCharacteristics
- func (h *MemHive) Commit() (bool, error)
- func (h *MemHive) Delete(key string)
- func (h *MemHive) Get(key string) (*HiveValue, error)
- func (h *MemHive) GetBool(key string) (bool, error)
- func (h *MemHive) GetData() *map[string]HiveValue
- func (h *MemHive) GetFloat(key string) (float64, error)
- func (h *MemHive) GetInt(key string) (int, error)
- func (h *MemHive) GetString(key string) (*string, error)
- func (h *MemHive) Load() error
- func (h *MemHive) NewSub(key string)
- func (h *MemHive) Rollback() (bool, error)
- func (h *MemHive) Save() error
- func (h *MemHive) Set(key string, value interface{}) error
- func (h *MemHive) SetBool(key string, value bool) error
- func (h *MemHive) SetFloat(key string, value float64) error
- func (h *MemHive) SetInt(key string, value int) error
- func (h *MemHive) SetString(key string, value string) error
Constants ¶
View Source
const ( HiveTypeBool = iota HiveTypeByte HiveTypeInt64 HiveTypeUint64 HiveTypeFloat64 HiveTypeInt HiveTypeUint HiveTypeFloat32 HiveTypeString HiveTypeBytes HiveTypeSub )
Variables ¶
View Source
var HiveTypeMap map[int]string = map[int]string{
0: "bool",
1: "byte",
2: "int64",
3: "uint64",
4: "float64",
5: "int",
6: "uint",
7: "float32",
8: "string",
9: "bytes",
10: "sub",
}
Functions ¶
func GenericMapToSubMap ¶
func HiveMapToGeneric ¶
Types ¶
type BinHive ¶
type BinHive struct {
Stream *bufio.ReadWriter
// contains filtered or unexported fields
}
BinHive is a hive built on top of MemHive that can be serialized and loaded to/from a writer.
func NewBinHive ¶
func (*BinHive) Characteristics ¶
func (h *BinHive) Characteristics() HiveCharacteristics
type Hive ¶
type Hive interface {
// Characteristics Gets the characteristics of the hive.
Characteristics() HiveCharacteristics
// Load the hive from some persistent storage.
Load() error
// Get Gets a value from the hive.
// Returns nil, false if the value does not exist.
Get(key string) (*HiveValue, error)
GetBool(key string) (bool, error)
GetInt(key string) (int, error)
GetFloat(key string) (float64, error)
GetString(key string) (*string, error)
// Set Sets a value in the hive.
// If the value already exists, it's replaced.
Set(key string, value interface{}) error
SetBool(key string, value bool) error
SetInt(key string, value int) error
SetFloat(key string, value float64) error
SetString(key string, value string) error
// Delete Deletes a value from the hive.
// Returns the old value, or nil if the value did not exist.
Delete(key string)
// NewSub Create a sub-hive with the given key.
NewSub(key string)
// Rollback Rolls back the hive to the last commit.
// Returns true if the hive was rolled back.
// For some hives, this is a no-op.
Rollback() (bool, error)
// Commit Commits the hive.
// Returns true if the hive was committed.
// For some hives, this is a no-op.
Commit() (bool, error)
// Save Saves the hive to some persistent storage.
// Unlike Commit this always saves the hive.
Save() error
// GetData Get the data of the hive.
GetData() *map[string]HiveValue
}
type HiveCharacteristics ¶
type HiveValue ¶
type HiveValue struct {
// contains filtered or unexported fields
}
func NewHiveValue ¶
func (*HiveValue) IsStoredType ¶
func (*HiveValue) TypeString ¶
type MemHive ¶
type MemHive struct {
// contains filtered or unexported fields
}
MemHive A hive that is memory resident.
func (*MemHive) Characteristics ¶
func (h *MemHive) Characteristics() HiveCharacteristics
Characteristics Gets the characteristics of the hive.
Click to show internal directories.
Click to hide internal directories.