Documentation ¶
Overview ¶
Package record contains code and types for storage records manipulation.
Index ¶
- Constants
- func CalculateIDForBlob(scheme core.PlatformCryptographyScheme, pulseNumber core.PulseNumber, ...) *core.RecordID
- func NewRecordIDFromRecord(scheme core.PlatformCryptographyScheme, pulse core.PulseNumber, rec Record) *core.RecordID
- func SerializeRecord(rec Record) []byte
- func SerializeType(id TypeID) []byte
- type ChildRecord
- type CodeRecord
- type DeactivationRecord
- func (r *DeactivationRecord) GetImage() *core.RecordRef
- func (r *DeactivationRecord) GetIsPrototype() bool
- func (*DeactivationRecord) GetMachineType() core.MachineType
- func (*DeactivationRecord) GetMemory() *core.RecordID
- func (r *DeactivationRecord) PrevStateID() *core.RecordID
- func (r *DeactivationRecord) State() State
- func (r *DeactivationRecord) Type() TypeID
- func (r *DeactivationRecord) WriteHashData(w io.Writer) (int, error)
- type GenesisRecord
- func (*GenesisRecord) GetImage() *core.RecordRef
- func (*GenesisRecord) GetIsPrototype() bool
- func (*GenesisRecord) GetMemory() *core.RecordID
- func (r *GenesisRecord) PrevStateID() *core.RecordID
- func (r *GenesisRecord) State() State
- func (r *GenesisRecord) Type() TypeID
- func (r *GenesisRecord) WriteHashData(w io.Writer) (int, error)
- type JetRecord
- type ObjectActivateRecord
- type ObjectAmendRecord
- type ObjectState
- type ObjectStateRecord
- type Record
- type Request
- type RequestRecord
- type ResultRecord
- type SideEffectRecord
- type State
- type TypeID
- type TypeRecord
Constants ¶
const ( // StateUndefined is used for special cases. StateUndefined = State(iota) // StateActivation means it's an activation record. StateActivation // StateAmend means it's an amend record. StateAmend // StateDeactivation means it's a deactivation record. StateDeactivation )
const TypeIDSize = 4
TypeIDSize is a size of TypeID type.
Variables ¶
This section is empty.
Functions ¶
func CalculateIDForBlob ¶
func CalculateIDForBlob(scheme core.PlatformCryptographyScheme, pulseNumber core.PulseNumber, blob []byte) *core.RecordID
CalculateIDForBlob calculate id for blob with using current pulse number
func NewRecordIDFromRecord ¶
func NewRecordIDFromRecord(scheme core.PlatformCryptographyScheme, pulse core.PulseNumber, rec Record) *core.RecordID
func SerializeRecord ¶
SerializeRecord returns binary representation of provided record.
func SerializeType ¶
SerializeType returns binary representation of provided type.
Types ¶
type ChildRecord ¶
type ChildRecord struct { PrevChild *core.RecordID Ref core.RecordRef // Reference to the child's head. }
ChildRecord is a child activation record. Its used for children iterating.
func (*ChildRecord) Type ¶
func (r *ChildRecord) Type() TypeID
Type implementation of Record interface.
func (*ChildRecord) WriteHashData ¶
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 CodeRecord ¶
type CodeRecord struct { SideEffectRecord Code *core.RecordID MachineType core.MachineType }
CodeRecord is a code storage record.
func (*CodeRecord) Type ¶
func (r *CodeRecord) Type() TypeID
Type implementation of Record interface.
func (*CodeRecord) WriteHashData ¶
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 { SideEffectRecord PrevState core.RecordID }
DeactivationRecord marks targeted object as disabled.
func (*DeactivationRecord) GetImage ¶
func (r *DeactivationRecord) GetImage() *core.RecordRef
GetImage returns state code.
func (*DeactivationRecord) GetIsPrototype ¶
func (r *DeactivationRecord) GetIsPrototype() bool
GetIsPrototype returns state code.
func (*DeactivationRecord) GetMachineType ¶
func (*DeactivationRecord) GetMachineType() core.MachineType
GetMachineType returns state code machine type.
func (*DeactivationRecord) GetMemory ¶
func (*DeactivationRecord) GetMemory() *core.RecordID
GetMemory returns state memory.
func (*DeactivationRecord) PrevStateID ¶
func (r *DeactivationRecord) PrevStateID() *core.RecordID
PrevStateID returns previous state id.
func (*DeactivationRecord) State ¶
func (r *DeactivationRecord) State() State
State returns state id.
func (*DeactivationRecord) Type ¶
func (r *DeactivationRecord) Type() TypeID
Type implementation of Record interface.
func (*DeactivationRecord) WriteHashData ¶
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 ¶
type GenesisRecord struct { }
GenesisRecord is the first record created on storage. It's used to link root objects to it.
func (*GenesisRecord) GetImage ¶
func (*GenesisRecord) GetImage() *core.RecordRef
GetImage returns state code.
func (*GenesisRecord) GetIsPrototype ¶
func (*GenesisRecord) GetIsPrototype() bool
GetIsPrototype returns state code.
func (*GenesisRecord) GetMemory ¶
func (*GenesisRecord) GetMemory() *core.RecordID
GetMemory returns state memory.
func (*GenesisRecord) PrevStateID ¶
func (r *GenesisRecord) PrevStateID() *core.RecordID
PrevStateID returns previous state id.
func (*GenesisRecord) Type ¶
func (r *GenesisRecord) Type() TypeID
Type implementation of Record interface.
func (*GenesisRecord) WriteHashData ¶
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 ObjectActivateRecord ¶
type ObjectActivateRecord struct { SideEffectRecord ObjectStateRecord Parent core.RecordRef IsDelegate bool }
ObjectActivateRecord is produced when we instantiate new object from an available prototype.
func (*ObjectActivateRecord) PrevStateID ¶
func (r *ObjectActivateRecord) PrevStateID() *core.RecordID
PrevStateID returns previous state id.
func (*ObjectActivateRecord) State ¶
func (r *ObjectActivateRecord) State() State
State returns state id.
func (*ObjectActivateRecord) Type ¶
func (r *ObjectActivateRecord) Type() TypeID
Type implementation of Record interface.
func (*ObjectActivateRecord) WriteHashData ¶
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 { SideEffectRecord ObjectStateRecord PrevState core.RecordID }
ObjectAmendRecord is an amendment record for objects.
func (*ObjectAmendRecord) PrevStateID ¶
func (r *ObjectAmendRecord) PrevStateID() *core.RecordID
PrevStateID returns previous state id.
func (*ObjectAmendRecord) Type ¶
func (r *ObjectAmendRecord) Type() TypeID
Type implementation of Record interface.
func (*ObjectAmendRecord) WriteHashData ¶
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 ¶
type ObjectState interface { // State returns state id. State() State // GetImage returns state code. GetImage() *core.RecordRef // GetIsPrototype returns state code. GetIsPrototype() bool // GetMemory returns state memory. GetMemory() *core.RecordID // PrevStateID returns previous state id. PrevStateID() *core.RecordID }
ObjectState is common object state record.
type ObjectStateRecord ¶
type ObjectStateRecord struct { Memory *core.RecordID Image core.RecordRef // If code or prototype object reference. IsPrototype bool // If true, Image should point to a prototype object. Otherwise to a code. }
ObjectStateRecord is a record containing data for an object state.
func (*ObjectStateRecord) GetImage ¶
func (r *ObjectStateRecord) GetImage() *core.RecordRef
GetImage returns state code.
func (*ObjectStateRecord) GetIsPrototype ¶
func (r *ObjectStateRecord) GetIsPrototype() bool
GetIsPrototype returns state code.
func (*ObjectStateRecord) GetMemory ¶
func (r *ObjectStateRecord) GetMemory() *core.RecordID
GetMemory returns state memory.
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 ¶
DeserializeRecord returns record decoded from bytes.
type RequestRecord ¶
RequestRecord is a contract execution request.
func (*RequestRecord) GetObject ¶
func (r *RequestRecord) GetObject() core.RecordID
GetObject returns request object.
func (*RequestRecord) GetPayload ¶
func (r *RequestRecord) GetPayload() []byte
GetPayload returns payload. Required for Record interface implementation.
func (*RequestRecord) Type ¶
func (r *RequestRecord) Type() TypeID
Type implementation of Record interface.
func (*RequestRecord) WriteHashData ¶
func (r *RequestRecord) WriteHashData(w io.Writer) (int, error)
WriteHashData writes record data to provided writer. This data is used to calculate record's hash.
type ResultRecord ¶
ResultRecord represents result of a VM method.
func (ResultRecord) Type ¶
func (ResultRecord) Type() TypeID
Type implementation of Record interface.
func (*ResultRecord) WriteHashData ¶
func (r *ResultRecord) WriteHashData(w io.Writer) (int, error)
WriteHashData writes record data to provided writer. This data is used to calculate record's hash.
type SideEffectRecord ¶
SideEffectRecord is a record which is created in response to a request.
type TypeID ¶
type TypeID uint32
TypeID encodes a record object type.
func DeserializeType ¶
DeserializeType returns type from provided binary representation.
type TypeRecord ¶
type TypeRecord struct { SideEffectRecord TypeDeclaration []byte }
TypeRecord is a code interface declaration.
func (*TypeRecord) Type ¶
func (r *TypeRecord) Type() TypeID
Type implementation of Record interface.
func (*TypeRecord) WriteHashData ¶
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.