Documentation ¶
Overview ¶
Package state holds data and it's state
Index ¶
- Variables
- func IsValidKey(s string) error
- type BytesValue
- func (bv BytesValue) Equal(v Value) bool
- func (bv BytesValue) Hash() valuehash.Hash
- func (bv BytesValue) Interface() interface{}
- func (bv BytesValue) IsValid([]byte) error
- func (bv BytesValue) MarshalBSON() ([]byte, error)
- func (bv BytesValue) MarshalJSON() ([]byte, error)
- func (bv BytesValue) Set(v interface{}) (Value, error)
- func (bv *BytesValue) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
- func (bv *BytesValue) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
- type BytesValueUnpackerBSON
- type DurationValue
- func (dv DurationValue) Equal(v Value) bool
- func (dv DurationValue) Hash() valuehash.Hash
- func (dv DurationValue) Interface() interface{}
- func (dv DurationValue) IsValid([]byte) error
- func (dv DurationValue) MarshalBSON() ([]byte, error)
- func (dv DurationValue) MarshalJSON() ([]byte, error)
- func (dv DurationValue) Set(v interface{}) (Value, error)
- func (dv *DurationValue) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
- func (dv *DurationValue) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
- type DurationValueUnpackerBSON
- type FixedTreeNode
- type HintedValue
- func (hv HintedValue) Equal(v Value) bool
- func (hv HintedValue) Hash() valuehash.Hash
- func (hv HintedValue) Interface() interface{}
- func (hv HintedValue) IsValid([]byte) error
- func (hv HintedValue) MarshalBSON() ([]byte, error)
- func (hv HintedValue) MarshalJSON() ([]byte, error)
- func (hv HintedValue) Set(v interface{}) (Value, error)
- func (hv *HintedValue) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
- func (hv *HintedValue) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
- type HintedValueUnpackerBSON
- type NumberValue
- func (nv NumberValue) Equal(v Value) bool
- func (nv NumberValue) Hash() valuehash.Hash
- func (nv NumberValue) Interface() interface{}
- func (nv NumberValue) IsValid([]byte) error
- func (nv NumberValue) MarshalBSON() ([]byte, error)
- func (nv NumberValue) MarshalJSON() ([]byte, error)
- func (nv NumberValue) Set(v interface{}) (Value, error)
- func (nv NumberValue) Type() reflect.Kind
- func (nv *NumberValue) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
- func (nv *NumberValue) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
- type NumberValueBSONUnpacker
- type NumberValueJSONPacker
- type NumberValueJSONUnpacker
- type PreProcessor
- type Processor
- type SliceValue
- func (sv SliceValue) Equal(v Value) bool
- func (sv SliceValue) Hash() valuehash.Hash
- func (sv SliceValue) Interface() interface{}
- func (sv SliceValue) IsValid([]byte) error
- func (sv SliceValue) MarshalBSON() ([]byte, error)
- func (sv SliceValue) MarshalJSON() ([]byte, error)
- func (sv SliceValue) Set(v interface{}) (Value, error)
- func (sv *SliceValue) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
- func (sv *SliceValue) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
- type State
- type StateUpdater
- func (stu *StateUpdater) AddOperation(op valuehash.Hash) error
- func (stu *StateUpdater) GetState() State
- func (stu *StateUpdater) Merge(source State) error
- func (stu *StateUpdater) Operations() []valuehash.Hash
- func (stu *StateUpdater) Reset() error
- func (stu *StateUpdater) SetHash(h valuehash.Hash) error
- func (stu *StateUpdater) SetHeight(h base.Height) *StateUpdater
- func (stu *StateUpdater) SetValue(value Value) error
- type StateV0
- func (st StateV0) BSONM() bson.M
- func (st StateV0) Clear() State
- func (st StateV0) GenerateHash() valuehash.Hash
- func (st StateV0) Hash() valuehash.Hash
- func (st StateV0) Height() base.Height
- func (StateV0) Hint() hint.Hint
- func (st StateV0) IsValid([]byte) error
- func (st StateV0) Key() string
- func (st StateV0) MarshalBSON() ([]byte, error)
- func (st StateV0) MarshalJSON() ([]byte, error)
- func (st StateV0) Merge(source State) (State, error)
- func (st StateV0) Operations() []valuehash.Hash
- func (st StateV0) PackerJSON() StateV0PackerJSON
- func (st StateV0) PreviousHeight() base.Height
- func (st StateV0) SetHash(h valuehash.Hash) (State, error)
- func (st StateV0) SetHeight(h base.Height) State
- func (st StateV0) SetOperation(ops []valuehash.Hash) State
- func (st StateV0) SetPreviousHeight(h base.Height) (State, error)
- func (st StateV0) SetValue(value Value) (State, error)
- func (st *StateV0) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
- func (st *StateV0) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
- func (st StateV0) Value() Value
- type StateV0PackerJSON
- type StateV0UnpackerBSON
- type StateV0UnpackerJSON
- type StringValue
- func (sv StringValue) Equal(v Value) bool
- func (sv StringValue) Hash() valuehash.Hash
- func (sv StringValue) Interface() interface{}
- func (sv StringValue) IsValid([]byte) error
- func (sv StringValue) MarshalBSON() ([]byte, error)
- func (sv StringValue) MarshalJSON() ([]byte, error)
- func (sv StringValue) Set(v interface{}) (Value, error)
- func (sv *StringValue) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
- func (sv *StringValue) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
- type StringValueUnpackerBSON
- type Value
Constants ¶
This section is empty.
Variables ¶
View Source
var ( StateUpdaterPoolGet = func() *StateUpdater { return stateUpdaterPool.Get().(*StateUpdater) } StateUpdaterPoolPut = func(stu *StateUpdater) { stu.Lock() defer stu.Unlock() stu.State = nil stu.opcache = nil stu.orig = nil stu.height = base.NilHeight stu.operations = nil stateUpdaterPool.Put(stu) } )
View Source
var ( StateV0Type = hint.Type("stete") StateV0Hint = hint.NewHint(StateV0Type, "v0.0.1") )
View Source
var ( FixedTreeNodeType = hint.Type("state-fixedtree-node") FixedTreeNodeHint = hint.NewHint(FixedTreeNodeType, "v0.0.1") FixedTreeNodeHinter = FixedTreeNode{ BaseFixedTreeNode: tree.BaseFixedTreeNode{BaseHinter: hint.NewBaseHinter(FixedTreeNodeHint)}, } )
View Source
var ( BytesValueType = hint.Type("state-bytes-value") BytesValueHint = hint.NewHint(BytesValueType, "v0.0.1") BytesValueHinter = BytesValue{BaseHinter: hint.NewBaseHinter(BytesValueHint)} )
View Source
var ( DurationValueType = hint.Type("state-duration-value") DurationValueHint = hint.NewHint(DurationValueType, "v0.0.1") DurationValueHinter = DurationValue{BaseHinter: hint.NewBaseHinter(DurationValueHint)} )
View Source
var ( HintedValueType = hint.Type("state-hinted-value") HintedValueHint = hint.NewHint(HintedValueType, "v0.0.1") HintedValueHinter = HintedValue{BaseHinter: hint.NewBaseHinter(HintedValueHint)} )
View Source
var ( NumberValueType = hint.Type("state-number-value") NumberValueHint = hint.NewHint(NumberValueType, "v0.0.1") NumberValueHinter = NumberValue{BaseHinter: hint.NewBaseHinter(NumberValueHint)} )
View Source
var ( SliceValueType = hint.Type("state-slice-value") SliceValueHint = hint.NewHint(SliceValueType, "v0.0.1") SliceValueHinter = SliceValue{BaseHinter: hint.NewBaseHinter(SliceValueHint)} )
View Source
var ( StringValueType = hint.Type("state-string-value") StringValueHint = hint.NewHint(StringValueType, "v0.0.1") StringValueHinter = StringValue{BaseHinter: hint.NewBaseHinter(StringValueHint)} )
Functions ¶
func IsValidKey ¶
Types ¶
type BytesValue ¶
type BytesValue struct { hint.BaseHinter // contains filtered or unexported fields }
func NewBytesValue ¶
func NewBytesValue(v interface{}) (BytesValue, error)
func (BytesValue) Equal ¶
func (bv BytesValue) Equal(v Value) bool
func (BytesValue) Hash ¶
func (bv BytesValue) Hash() valuehash.Hash
func (BytesValue) Interface ¶
func (bv BytesValue) Interface() interface{}
func (BytesValue) IsValid ¶
func (bv BytesValue) IsValid([]byte) error
func (BytesValue) MarshalBSON ¶
func (bv BytesValue) MarshalBSON() ([]byte, error)
func (BytesValue) MarshalJSON ¶
func (bv BytesValue) MarshalJSON() ([]byte, error)
func (BytesValue) Set ¶
func (bv BytesValue) Set(v interface{}) (Value, error)
func (*BytesValue) UnpackBSON ¶
func (bv *BytesValue) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
func (*BytesValue) UnpackJSON ¶
func (bv *BytesValue) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
type BytesValueUnpackerBSON ¶
type DurationValue ¶
type DurationValue struct { hint.BaseHinter // contains filtered or unexported fields }
func NewDurationValue ¶
func NewDurationValue(d time.Duration) (DurationValue, error)
func (DurationValue) Equal ¶
func (dv DurationValue) Equal(v Value) bool
func (DurationValue) Hash ¶
func (dv DurationValue) Hash() valuehash.Hash
func (DurationValue) Interface ¶
func (dv DurationValue) Interface() interface{}
func (DurationValue) IsValid ¶
func (dv DurationValue) IsValid([]byte) error
func (DurationValue) MarshalBSON ¶
func (dv DurationValue) MarshalBSON() ([]byte, error)
func (DurationValue) MarshalJSON ¶
func (dv DurationValue) MarshalJSON() ([]byte, error)
func (DurationValue) Set ¶
func (dv DurationValue) Set(v interface{}) (Value, error)
func (*DurationValue) UnpackBSON ¶
func (dv *DurationValue) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
func (*DurationValue) UnpackJSON ¶
func (dv *DurationValue) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
type FixedTreeNode ¶
type FixedTreeNode struct {
tree.BaseFixedTreeNode
}
func NewFixedTreeNode ¶
func NewFixedTreeNode(index uint64, key []byte) FixedTreeNode
func (*FixedTreeNode) UnmarshalBSON ¶
func (no *FixedTreeNode) UnmarshalBSON(b []byte) error
func (*FixedTreeNode) UnmarshalJSON ¶
func (no *FixedTreeNode) UnmarshalJSON(b []byte) error
type HintedValue ¶
type HintedValue struct { hint.BaseHinter // contains filtered or unexported fields }
func NewHintedValue ¶
func NewHintedValue(v hint.Hinter) (HintedValue, error)
func (HintedValue) Equal ¶
func (hv HintedValue) Equal(v Value) bool
func (HintedValue) Hash ¶
func (hv HintedValue) Hash() valuehash.Hash
func (HintedValue) Interface ¶
func (hv HintedValue) Interface() interface{}
func (HintedValue) IsValid ¶
func (hv HintedValue) IsValid([]byte) error
func (HintedValue) MarshalBSON ¶
func (hv HintedValue) MarshalBSON() ([]byte, error)
func (HintedValue) MarshalJSON ¶
func (hv HintedValue) MarshalJSON() ([]byte, error)
func (HintedValue) Set ¶
func (hv HintedValue) Set(v interface{}) (Value, error)
func (*HintedValue) UnpackBSON ¶
func (hv *HintedValue) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
func (*HintedValue) UnpackJSON ¶
func (hv *HintedValue) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
type HintedValueUnpackerBSON ¶
type NumberValue ¶
type NumberValue struct { hint.BaseHinter // contains filtered or unexported fields }
func NewNumberValue ¶
func NewNumberValue(v interface{}) (NumberValue, error)
func (NumberValue) Equal ¶
func (nv NumberValue) Equal(v Value) bool
func (NumberValue) Hash ¶
func (nv NumberValue) Hash() valuehash.Hash
func (NumberValue) Interface ¶
func (nv NumberValue) Interface() interface{}
func (NumberValue) IsValid ¶
func (nv NumberValue) IsValid([]byte) error
func (NumberValue) MarshalBSON ¶
func (nv NumberValue) MarshalBSON() ([]byte, error)
func (NumberValue) MarshalJSON ¶
func (nv NumberValue) MarshalJSON() ([]byte, error)
func (NumberValue) Set ¶
func (nv NumberValue) Set(v interface{}) (Value, error)
func (NumberValue) Type ¶
func (nv NumberValue) Type() reflect.Kind
func (*NumberValue) UnpackBSON ¶
func (nv *NumberValue) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
func (*NumberValue) UnpackJSON ¶
func (nv *NumberValue) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
type NumberValueBSONUnpacker ¶
type NumberValueJSONPacker ¶
type NumberValueJSONUnpacker ¶
type PreProcessor ¶
type SliceValue ¶
type SliceValue struct { hint.BaseHinter // contains filtered or unexported fields }
SliceValue only supports the interface{} implements hint.Hinter and valuehash.Hasher().
func NewSliceValue ¶
func NewSliceValue(v interface{}) (SliceValue, error)
func (SliceValue) Equal ¶
func (sv SliceValue) Equal(v Value) bool
func (SliceValue) Hash ¶
func (sv SliceValue) Hash() valuehash.Hash
func (SliceValue) Interface ¶
func (sv SliceValue) Interface() interface{}
func (SliceValue) IsValid ¶
func (sv SliceValue) IsValid([]byte) error
func (SliceValue) MarshalBSON ¶
func (sv SliceValue) MarshalBSON() ([]byte, error)
func (SliceValue) MarshalJSON ¶
func (sv SliceValue) MarshalJSON() ([]byte, error)
func (SliceValue) Set ¶
func (sv SliceValue) Set(v interface{}) (Value, error)
func (*SliceValue) UnpackBSON ¶
func (sv *SliceValue) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
func (*SliceValue) UnpackJSON ¶
func (sv *SliceValue) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
type State ¶
type State interface { isvalid.IsValider hint.Hinter valuehash.Hasher Key() string Value() Value SetValue(Value) (State, error) SetHash(valuehash.Hash) (State, error) Height() base.Height SetHeight(base.Height) State PreviousHeight() base.Height SetPreviousHeight(base.Height) (State, error) Operations() []valuehash.Hash SetOperation([]valuehash.Hash) State GenerateHash() valuehash.Hash Merge(State) (State, error) Clear() State }
type StateUpdater ¶
func NewStateUpdater ¶
func NewStateUpdater(st State) *StateUpdater
func (*StateUpdater) AddOperation ¶
func (stu *StateUpdater) AddOperation(op valuehash.Hash) error
func (*StateUpdater) GetState ¶
func (stu *StateUpdater) GetState() State
func (*StateUpdater) Merge ¶
func (stu *StateUpdater) Merge(source State) error
func (*StateUpdater) Operations ¶
func (stu *StateUpdater) Operations() []valuehash.Hash
func (*StateUpdater) Reset ¶
func (stu *StateUpdater) Reset() error
func (*StateUpdater) SetHeight ¶
func (stu *StateUpdater) SetHeight(h base.Height) *StateUpdater
func (*StateUpdater) SetValue ¶
func (stu *StateUpdater) SetValue(value Value) error
type StateV0 ¶
type StateV0 struct {
// contains filtered or unexported fields
}
func (StateV0) GenerateHash ¶
func (StateV0) MarshalBSON ¶
func (StateV0) MarshalJSON ¶
func (StateV0) Operations ¶
func (StateV0) PackerJSON ¶
func (st StateV0) PackerJSON() StateV0PackerJSON
func (StateV0) PreviousHeight ¶
func (StateV0) SetPreviousHeight ¶
type StateV0PackerJSON ¶
type StateV0UnpackerBSON ¶
type StateV0UnpackerJSON ¶
type StringValue ¶
type StringValue struct { hint.BaseHinter // contains filtered or unexported fields }
func NewStringValue ¶
func NewStringValue(v interface{}) (StringValue, error)
func (StringValue) Equal ¶
func (sv StringValue) Equal(v Value) bool
func (StringValue) Hash ¶
func (sv StringValue) Hash() valuehash.Hash
func (StringValue) Interface ¶
func (sv StringValue) Interface() interface{}
func (StringValue) IsValid ¶
func (sv StringValue) IsValid([]byte) error
func (StringValue) MarshalBSON ¶
func (sv StringValue) MarshalBSON() ([]byte, error)
func (StringValue) MarshalJSON ¶
func (sv StringValue) MarshalJSON() ([]byte, error)
func (StringValue) Set ¶
func (sv StringValue) Set(v interface{}) (Value, error)
func (*StringValue) UnpackBSON ¶
func (sv *StringValue) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
func (*StringValue) UnpackJSON ¶
func (sv *StringValue) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
type StringValueUnpackerBSON ¶
Source Files ¶
- doc.go
- operation.go
- pool.go
- state.go
- state_v0.go
- state_v0_bson.go
- state_v0_encode.go
- state_v0_json.go
- tree.go
- tree_bson.go
- tree_json.go
- util.go
- value.go
- value_bytes.go
- value_bytes_bson.go
- value_bytes_json.go
- value_duration.go
- value_duration_bson.go
- value_duration_json.go
- value_hinted.go
- value_hinted_bson.go
- value_hinted_json.go
- value_number.go
- value_number_bson.go
- value_number_encode.go
- value_number_json.go
- value_slice.go
- value_slice_bson.go
- value_slice_encode.go
- value_slice_json.go
- value_string.go
- value_string_bson.go
- value_string_json.go
Click to show internal directories.
Click to hide internal directories.