Documentation ¶
Overview ¶
Package record contains code and types for storage records manipulation.
Index ¶
- Constants
- func ID2Bytes(id ID) []byte
- func SerializeRecord(rec Record) []byte
- func SerializeType(id TypeID) []byte
- type CallRequest
- type ChildRecord
- type ClassActivateRecord
- type ClassAmendRecord
- type ClassState
- type ClassStateRecord
- type CodeRecord
- type DeactivationRecord
- func (*DeactivationRecord) GetCode() *Reference
- func (*DeactivationRecord) GetMachineType() core.MachineType
- func (*DeactivationRecord) GetMemory() []byte
- func (*DeactivationRecord) IsAmend() bool
- func (*DeactivationRecord) IsDeactivation() bool
- func (r *DeactivationRecord) Type() TypeID
- func (r *DeactivationRecord) WriteHashData(w io.Writer) (int, error)
- type GenesisRecord
- type ID
- type ObjectActivateRecord
- type ObjectAmendRecord
- type ObjectState
- type ObjectStateRecord
- type PulseRecord
- type Record
- type Reference
- type Request
- type ResultRecord
- type TypeID
- type TypeRecord
Constants ¶
const TypeIDSize = 4
TypeIDSize is a size of TypeID type.
Variables ¶
This section is empty.
Functions ¶
func SerializeRecord ¶ added in v0.6.1
SerializeRecord returns binary representation of provided record.
func SerializeType ¶ added in v0.6.1
SerializeType returns binary representation of provided type.
Types ¶
type CallRequest ¶
type CallRequest struct {
Payload []byte
}
CallRequest is a contract execution request.
func (*CallRequest) GetPayload ¶ added in v0.5.0
func (r *CallRequest) GetPayload() []byte
GetPayload returns payload. Required for Record interface implementation.
func (*CallRequest) Type ¶ added in v0.6.1
func (r *CallRequest) Type() TypeID
Type implementation of Record interface.
func (*CallRequest) WriteHashData ¶ added in v0.6.1
func (r *CallRequest) WriteHashData(w io.Writer) (int, error)
WriteHashData writes record data to provided writer. This data is used to calculate record's hash.
type ChildRecord ¶ added in v0.5.0
ChildRecord is a child activation record. Its used for children iterating.
func (*ChildRecord) Type ¶ added in v0.6.1
func (r *ChildRecord) Type() TypeID
Type implementation of Record interface.
func (*ChildRecord) WriteHashData ¶ added in v0.6.1
func (r *ChildRecord) WriteHashData(w io.Writer) (int, error)
WriteHashData writes record data to provided writer. This data is used to calculate record's hash.
type ClassActivateRecord ¶
type ClassActivateRecord struct { ResultRecord ClassStateRecord }
ClassActivateRecord is produced when we "activate" new contract class.
func (*ClassActivateRecord) Type ¶ added in v0.6.1
func (r *ClassActivateRecord) Type() TypeID
Type implementation of Record interface.
func (*ClassActivateRecord) WriteHashData ¶ added in v0.6.1
func (r *ClassActivateRecord) WriteHashData(w io.Writer) (int, error)
WriteHashData writes record data to provided writer. This data is used to calculate record's hash.
type ClassAmendRecord ¶
type ClassAmendRecord struct { ResultRecord ClassStateRecord PrevState ID }
ClassAmendRecord is an amendment record for classes.
func (*ClassAmendRecord) Type ¶ added in v0.6.1
func (r *ClassAmendRecord) Type() TypeID
Type implementation of Record interface.
func (*ClassAmendRecord) WriteHashData ¶ added in v0.6.1
func (r *ClassAmendRecord) WriteHashData(w io.Writer) (int, error)
WriteHashData writes record data to provided writer. This data is used to calculate record's hash.
type ClassState ¶ added in v0.3.0
type ClassState interface { // IsDeactivation determines if current state is deactivation. IsDeactivation() bool // GetCode returns state code. GetCode() *Reference // GetMachineType returns state code machine type. GetMachineType() core.MachineType }
ClassState is common class state record.
type ClassStateRecord ¶ added in v0.6.1
type ClassStateRecord struct { Code Reference MachineType core.MachineType }
ClassStateRecord is a record containing data for a class state.
func (*ClassStateRecord) GetCode ¶ added in v0.6.1
func (r *ClassStateRecord) GetCode() *Reference
GetCode returns state code.
func (*ClassStateRecord) GetMachineType ¶ added in v0.6.1
func (r *ClassStateRecord) GetMachineType() core.MachineType
GetMachineType returns state code machine type.
func (*ClassStateRecord) IsDeactivation ¶ added in v0.6.1
func (r *ClassStateRecord) IsDeactivation() bool
IsDeactivation determines if current state is deactivation.
type CodeRecord ¶
type CodeRecord struct { ResultRecord Code []byte MachineType core.MachineType }
CodeRecord is a code storage record.
func (*CodeRecord) Type ¶ added in v0.6.1
func (r *CodeRecord) Type() TypeID
Type implementation of Record interface.
func (*CodeRecord) WriteHashData ¶ added in v0.6.1
func (r *CodeRecord) WriteHashData(w io.Writer) (int, error)
WriteHashData writes record data to provided writer. This data is used to calculate record's hash.
type DeactivationRecord ¶
type DeactivationRecord struct { ResultRecord PrevState ID }
DeactivationRecord marks targeted object as disabled.
func (*DeactivationRecord) GetCode ¶ added in v0.3.0
func (*DeactivationRecord) GetCode() *Reference
GetCode returns state code.
func (*DeactivationRecord) GetMachineType ¶ added in v0.6.1
func (*DeactivationRecord) GetMachineType() core.MachineType
GetMachineType returns state code machine type.
func (*DeactivationRecord) GetMemory ¶ added in v0.3.0
func (*DeactivationRecord) GetMemory() []byte
GetMemory returns state memory.
func (*DeactivationRecord) IsAmend ¶ added in v0.3.0
func (*DeactivationRecord) IsAmend() bool
IsAmend determines if current state is amend.
func (*DeactivationRecord) IsDeactivation ¶ added in v0.3.0
func (*DeactivationRecord) IsDeactivation() bool
IsDeactivation determines if current state is deactivation.
func (*DeactivationRecord) Type ¶ added in v0.6.1
func (r *DeactivationRecord) Type() TypeID
Type implementation of Record interface.
func (*DeactivationRecord) WriteHashData ¶ added in v0.6.1
func (r *DeactivationRecord) WriteHashData(w io.Writer) (int, error)
WriteHashData writes record data to provided writer. This data is used to calculate record's hash.
type GenesisRecord ¶ added in v0.6.0
type GenesisRecord struct { }
GenesisRecord is the first record created on storage. It's used to link root objects to it.
func (*GenesisRecord) GetCode ¶ added in v0.6.0
func (*GenesisRecord) GetCode() *Reference
GetCode returns state code.
func (*GenesisRecord) GetMemory ¶ added in v0.6.0
func (*GenesisRecord) GetMemory() []byte
GetMemory returns state memory.
func (*GenesisRecord) IsAmend ¶ added in v0.6.0
func (*GenesisRecord) IsAmend() bool
IsAmend determines if current state is amend.
func (*GenesisRecord) IsDeactivation ¶ added in v0.6.0
func (*GenesisRecord) IsDeactivation() bool
IsDeactivation determines if current state is deactivation.
func (*GenesisRecord) Type ¶ added in v0.6.1
func (r *GenesisRecord) Type() TypeID
Type implementation of Record interface.
func (*GenesisRecord) WriteHashData ¶ added in v0.6.1
func (r *GenesisRecord) WriteHashData(w io.Writer) (int, error)
WriteHashData writes record data to provided writer. This data is used to calculate record's hash.
type ID ¶ added in v0.0.2
type ID struct { Pulse core.PulseNumber Hash []byte }
ID is a composite identifier for records.
Hash is a bytes slice here to avoid copy of Hash array.
type ObjectActivateRecord ¶
type ObjectActivateRecord struct { ResultRecord ObjectStateRecord Class Reference Parent Reference Delegate bool }
ObjectActivateRecord is produced when we instantiate new object from an available class.
func (*ObjectActivateRecord) Type ¶ added in v0.6.1
func (r *ObjectActivateRecord) Type() TypeID
Type implementation of Record interface.
func (*ObjectActivateRecord) WriteHashData ¶ added in v0.6.1
func (r *ObjectActivateRecord) WriteHashData(w io.Writer) (int, error)
WriteHashData writes record data to provided writer. This data is used to calculate record's hash.
type ObjectAmendRecord ¶
type ObjectAmendRecord struct { ResultRecord ObjectStateRecord PrevState ID }
ObjectAmendRecord is an amendment record for objects.
func (*ObjectAmendRecord) Type ¶ added in v0.6.1
func (r *ObjectAmendRecord) Type() TypeID
Type implementation of Record interface.
func (*ObjectAmendRecord) WriteHashData ¶ added in v0.6.1
func (r *ObjectAmendRecord) WriteHashData(w io.Writer) (int, error)
WriteHashData writes record data to provided writer. This data is used to calculate record's hash.
type ObjectState ¶ added in v0.3.0
type ObjectState interface { // IsDeactivation determines if current state is deactivation. IsDeactivation() bool // GetMemory returns state memory. GetMemory() []byte }
ObjectState is common object state record.
type ObjectStateRecord ¶ added in v0.6.1
type ObjectStateRecord struct {
Memory []byte
}
ObjectStateRecord is a record containing data for an object state.
func (*ObjectStateRecord) GetMemory ¶ added in v0.6.1
func (r *ObjectStateRecord) GetMemory() []byte
GetMemory returns state memory.
func (*ObjectStateRecord) IsDeactivation ¶ added in v0.6.1
func (r *ObjectStateRecord) IsDeactivation() bool
IsDeactivation determines if current state is deactivation.
type PulseRecord ¶ added in v0.6.0
type PulseRecord struct { PrevPulse core.PulseNumber Entropy core.Entropy PredictedNextPulse core.PulseNumber }
PulseRecord is a record containing pulse info.
type Record ¶
type Record interface { // Type returns record type. Type() TypeID // WriteHashData writes record data to provided writer. This data is used to calculate record's hash. WriteHashData(w io.Writer) (int, error) }
Record is base interface for all records.
func DeserializeRecord ¶ added in v0.6.1
DeserializeRecord returns record decoded from bytes.
type Reference ¶
Reference allows to address any record across the whole network.
func Core2Reference ¶ added in v0.0.5
Core2Reference converts commonly used reference to Ledger-specific.
func (*Reference) CoreRef ¶ added in v0.0.5
CoreRef generates Reference byte representation (key without prefix).
func (Reference) IsNotEqual ¶ added in v0.0.2
IsNotEqual checks non equality of References.
type ResultRecord ¶
ResultRecord is a record which is created in response to a request.
type TypeID ¶ added in v0.0.2
type TypeID uint32
TypeID encodes a record object type.
func DeserializeType ¶ added in v0.6.1
DeserializeType returns type from provided binary representation.
type TypeRecord ¶ added in v0.0.5
type TypeRecord struct { ResultRecord TypeDeclaration []byte }
TypeRecord is a code interface declaration.
func (*TypeRecord) Type ¶ added in v0.6.1
func (r *TypeRecord) Type() TypeID
Type implementation of Record interface.
func (*TypeRecord) WriteHashData ¶ added in v0.6.1
func (r *TypeRecord) WriteHashData(w io.Writer) (int, error)
WriteHashData writes record data to provided writer. This data is used to calculate record's hash.