Documentation ¶
Overview ¶
Package record contains code and types for storage records manipulation.
Index ¶
- Constants
- func Encode(rec Record) ([]byte, error)
- func EncodeRaw(raw *Raw) ([]byte, error)
- func ID2Bytes(id ID) []byte
- func MustEncode(rec Record) []byte
- func MustEncodeRaw(raw *Raw) []byte
- func SHA3Hash224(rec Record) []byte
- type ActivationRecord
- type AmendRecord
- type CallRequest
- type ClassActivateRecord
- type ClassAmendRecord
- type ClassState
- type CodeRecord
- type DeactivationRecord
- type EnforcedObjectAmendRecord
- type ID
- type LockUnlockRequest
- type LockUnlockResult
- type Memory
- type ObjectActivateRecord
- type ObjectAmendRecord
- type ObjectAppendRecord
- type ObjectState
- type ProjectionType
- type Raw
- type ReadObject
- type ReadObjectComposite
- type ReadObjectResult
- type ReadRecordRequest
- type ReadRecordResult
- type ReadRequest
- type ReasonCode
- type Record
- type Reference
- type RejectionResult
- type RequestRecord
- type ResultRecord
- type SpecialResult
- type StatefulCallResult
- type StatefulExceptionResult
- type StatefulResult
- type StatelessCallResult
- type StatelessExceptionResult
- type StatelessResult
- type StorageRecord
- type TypeID
- type TypeRecord
- type WipeOutRecord
Constants ¶
const RelativePulseNumber core.PulseNumber = 65536
RelativePulseNumber - special value of PulseNum, it means a Drop-relative Pulse Number. It is only allowed for Storage.
Variables ¶
This section is empty.
Functions ¶
func MustEncode ¶ added in v0.0.2
MustEncode wraps Encode, panics on encoding errors.
func MustEncodeRaw ¶ added in v0.0.2
MustEncodeRaw wraps EncodeRaw, panics on encode errors.
func SHA3Hash224 ¶ added in v0.0.2
SHA3Hash224 hashes Record by it's CBOR representation and type identifier.
Types ¶
type ActivationRecord ¶
type ActivationRecord struct { StatefulResult GoverningDomain Reference }
ActivationRecord is an activation record.
type AmendRecord ¶
type AmendRecord struct { StatefulResult HeadRecord Reference AmendedRecord Reference }
AmendRecord is produced when we modify another record in ledger.
type CallRequest ¶
type CallRequest struct { RequestRecord CallInterface Reference CallMethodSignature uint32 ParamMemory Memory }
CallRequest is a contract execution request. Implements io.ReadWriter interface.
func (*CallRequest) CallMethod ¶
func (r *CallRequest) CallMethod() uint32
CallMethod is a contract method number to call.
type ClassActivateRecord ¶
type ClassActivateRecord struct { ActivationRecord DefaultMemory Memory }
ClassActivateRecord is produced when we "activate" new contract class.
func (*ClassActivateRecord) GetCode ¶ added in v0.3.0
func (r *ClassActivateRecord) GetCode() *Reference
func (*ClassActivateRecord) IsAmend ¶ added in v0.3.0
func (r *ClassActivateRecord) IsAmend() bool
func (*ClassActivateRecord) IsDeactivation ¶ added in v0.3.0
func (r *ClassActivateRecord) IsDeactivation() bool
type ClassAmendRecord ¶
type ClassAmendRecord struct { AmendRecord NewCode Reference // CodeRecord Migrations []Reference // CodeRecord }
ClassAmendRecord is an amendment record for classes.
func (*ClassAmendRecord) GetCode ¶ added in v0.3.0
func (r *ClassAmendRecord) GetCode() *Reference
func (*ClassAmendRecord) IsAmend ¶ added in v0.3.0
func (r *ClassAmendRecord) IsAmend() bool
func (*ClassAmendRecord) IsDeactivation ¶ added in v0.3.0
func (r *ClassAmendRecord) IsDeactivation() bool
type ClassState ¶ added in v0.3.0
type CodeRecord ¶
type CodeRecord struct { StorageRecord TargetedCode map[core.MachineType][]byte SourceCode string }
CodeRecord is a code storage record.
func (*CodeRecord) GetCode ¶ added in v0.0.2
func (r *CodeRecord) GetCode(archPref []core.MachineType) ([]byte, core.MachineType, error)
GetCode returns class code according to provided architecture preferences. If preferences are not provided or the record does not contain code for any of provided architectures an error will be returned.
type DeactivationRecord ¶
type DeactivationRecord struct {
AmendRecord
}
DeactivationRecord marks targeted object as disabled.
func (*DeactivationRecord) GetCode ¶ added in v0.3.0
func (*DeactivationRecord) GetCode() *Reference
func (*DeactivationRecord) GetMemory ¶ added in v0.3.0
func (*DeactivationRecord) GetMemory() []byte
func (*DeactivationRecord) IsAmend ¶ added in v0.3.0
func (*DeactivationRecord) IsAmend() bool
func (*DeactivationRecord) IsDeactivation ¶ added in v0.3.0
func (*DeactivationRecord) IsDeactivation() bool
type EnforcedObjectAmendRecord ¶
type EnforcedObjectAmendRecord struct {
ObjectAmendRecord
}
EnforcedObjectAmendRecord is an enforced amendment record for objects.
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 LockUnlockRequest ¶
type LockUnlockRequest struct { RequestRecord Transaction Reference ExpectedLockDuration time.Duration }
LockUnlockRequest is a request to temporary lock (or unlock) another record.
type LockUnlockResult ¶
type LockUnlockResult struct {
SpecialResult
}
LockUnlockResult is a result of lock/unlock attempts.
type ObjectActivateRecord ¶
type ObjectActivateRecord struct { ActivationRecord ClassActivateRecord Reference Memory Memory Parent Reference Delegate bool }
ObjectActivateRecord is produced when we instantiate new object from an available class.
func (*ObjectActivateRecord) GetMemory ¶ added in v0.3.0
func (r *ObjectActivateRecord) GetMemory() []byte
func (*ObjectActivateRecord) IsAmend ¶ added in v0.3.0
func (r *ObjectActivateRecord) IsAmend() bool
func (*ObjectActivateRecord) IsDeactivation ¶ added in v0.3.0
func (r *ObjectActivateRecord) IsDeactivation() bool
type ObjectAmendRecord ¶
type ObjectAmendRecord struct { AmendRecord NewMemory Memory }
ObjectAmendRecord is an amendment record for objects.
func (*ObjectAmendRecord) GetMemory ¶ added in v0.3.0
func (r *ObjectAmendRecord) GetMemory() []byte
func (*ObjectAmendRecord) IsAmend ¶ added in v0.3.0
func (r *ObjectAmendRecord) IsAmend() bool
func (*ObjectAmendRecord) IsDeactivation ¶ added in v0.3.0
func (r *ObjectAmendRecord) IsDeactivation() bool
type ObjectAppendRecord ¶
type ObjectAppendRecord struct { AmendRecord AppendMemory Memory }
ObjectAppendRecord is an "append state" record for objects. It does not contain full actual state.
type ObjectState ¶ added in v0.3.0
type ProjectionType ¶
type ProjectionType uint32
ProjectionType is a "view filter" for record. E.g. we can read whole object or just it's hash.
type Raw ¶ added in v0.0.2
Raw struct contains raw serialized record. We need raw blob to not have dependency on record structure changes in future, and have ability of consistent hash checking on old records.
func DecodeToRaw ¶ added in v0.0.2
DecodeToRaw decodes bytes to Raw struct from CBOR.
func EncodeToRaw ¶ added in v0.0.2
EncodeToRaw converts record to Raw record.
type ReadObject ¶
type ReadObject struct { ReadRequest ProjectionType ProjectionType }
ReadObject is a request type
type ReadObjectComposite ¶
type ReadObjectComposite struct { ReadObject CompositeType Reference }
ReadObjectComposite is a request to read object including it's "injected" fields.
type ReadObjectResult ¶
type ReadObjectResult struct { StatelessResult State int32 MemoryProjection Memory }
ReadObjectResult contains necessary object's memory.
type ReadRecordRequest ¶
type ReadRecordRequest struct { ReadRequest ExpectedRecordType TypeID }
ReadRecordRequest is a request type to read another record.
type ReadRecordResult ¶
type ReadRecordResult struct { StatelessResult RecordBody []byte }
ReadRecordResult just contains necessary record from storage.
type ReadRequest ¶
type ReadRequest struct {
RequestRecord
}
ReadRequest is a request type to read data.
type Record ¶
type Record interface {
Domain() *Reference
}
Record is base interface for all records.
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 RejectionResult ¶
type RejectionResult struct {
SpecialResult
}
RejectionResult is a result type for failed attempts.
type RequestRecord ¶
RequestRecord is common type for all requests.
func (*RequestRecord) Domain ¶ added in v0.0.2
func (rec *RequestRecord) Domain() *Reference
Domain implements Record interface
type ResultRecord ¶
ResultRecord is a common type for all results.
func (*ResultRecord) Domain ¶ added in v0.0.2
func (rec *ResultRecord) Domain() *Reference
Domain implements Record interface
type SpecialResult ¶
type SpecialResult struct { ResultRecord ReasonCode ReasonCode }
SpecialResult is a result type for special situations.
type StatefulCallResult ¶
type StatefulCallResult struct { ObjectAmendRecord ResultMemory Memory }
StatefulCallResult is a contract call result that produces new state.
type StatefulExceptionResult ¶
type StatefulExceptionResult struct { StatefulCallResult ExceptionType Reference }
StatefulExceptionResult is an exception result that needs to be stored.
type StatefulResult ¶
type StatefulResult struct {
ResultRecord
}
StatefulResult is a result type which contents need to be persistently stored.
type StatelessCallResult ¶
type StatelessCallResult struct { StatelessResult ResultMemory Memory }
StatelessCallResult is a contract call result that didn't produce new state.
type StatelessExceptionResult ¶
type StatelessExceptionResult struct { StatelessCallResult ExceptionType Reference }
StatelessExceptionResult is an exception result that does not need to be stored.
type StatelessResult ¶
type StatelessResult struct {
ResultRecord
}
StatelessResult is a result type that does not need to be stored.
type StorageRecord ¶
type StorageRecord struct {
StatefulResult
}
StorageRecord is produced when we store something in ledger. Code, data etc.
type TypeRecord ¶ added in v0.0.5
type TypeRecord struct { StorageRecord TypeDeclaration []byte }
TypeRecord is a code interface declaration.
type WipeOutRecord ¶
type WipeOutRecord struct { ResultRecord Replacement Reference WipedHash [core.RecordHashSize]byte }
WipeOutRecord is a special record that takes place of another record when we need to completely wipe out some information from storage (think GDPR).