record

package
v0.6.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package record contains code and types for storage records manipulation.

Index

Constants

View Source
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
)
View Source
const TypeIDSize = 4

TypeIDSize is a size of TypeID type.

Variables

This section is empty.

Functions

func CalculateIDForBlob added in v0.6.2

func CalculateIDForBlob(scheme core.PlatformCryptographyScheme, pulseNumber core.PulseNumber, blob []byte) *core.RecordID

CalculateIDForBlob calculate id for blob with using current pulse number

func SerializeRecord added in v0.6.1

func SerializeRecord(rec Record) []byte

SerializeRecord returns binary representation of provided record.

func SerializeType added in v0.6.1

func SerializeType(id TypeID) []byte

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

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 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 CodeRecord

type CodeRecord struct {
	SideEffectRecord

	Code        *core.RecordID
	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 {
	SideEffectRecord
	PrevState core.RecordID
}

DeactivationRecord marks targeted object as disabled.

func (*DeactivationRecord) GetImage added in v0.6.2

func (r *DeactivationRecord) GetImage() *core.RecordRef

GetImage returns state code.

func (*DeactivationRecord) GetIsPrototype added in v0.6.2

func (r *DeactivationRecord) GetIsPrototype() bool

GetIsPrototype 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() *core.RecordID

GetMemory returns state memory.

func (*DeactivationRecord) PrevStateID added in v0.6.2

func (r *DeactivationRecord) PrevStateID() *core.RecordID

PrevStateID returns previous state id.

func (*DeactivationRecord) State added in v0.6.2

func (r *DeactivationRecord) State() State

State returns state id.

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) GetImage added in v0.6.2

func (*GenesisRecord) GetImage() *core.RecordRef

GetImage returns state code.

func (*GenesisRecord) GetIsPrototype added in v0.6.2

func (*GenesisRecord) GetIsPrototype() bool

GetIsPrototype returns state code.

func (*GenesisRecord) GetMemory added in v0.6.0

func (*GenesisRecord) GetMemory() *core.RecordID

GetMemory returns state memory.

func (*GenesisRecord) PrevStateID added in v0.6.2

func (r *GenesisRecord) PrevStateID() *core.RecordID

PrevStateID returns previous state id.

func (*GenesisRecord) State added in v0.6.2

func (r *GenesisRecord) State() State

State returns state id.

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 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 added in v0.6.2

func (r *ObjectActivateRecord) PrevStateID() *core.RecordID

PrevStateID returns previous state id.

func (*ObjectActivateRecord) State added in v0.6.2

func (r *ObjectActivateRecord) State() State

State returns state id.

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 {
	SideEffectRecord
	ObjectStateRecord

	PrevState core.RecordID
}

ObjectAmendRecord is an amendment record for objects.

func (*ObjectAmendRecord) PrevStateID added in v0.6.2

func (r *ObjectAmendRecord) PrevStateID() *core.RecordID

PrevStateID returns previous state id.

func (*ObjectAmendRecord) State added in v0.6.2

func (r *ObjectAmendRecord) State() State

State returns state id.

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 {
	// 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 added in v0.6.1

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 added in v0.6.2

func (r *ObjectStateRecord) GetImage() *core.RecordRef

GetImage returns state code.

func (*ObjectStateRecord) GetIsPrototype added in v0.6.2

func (r *ObjectStateRecord) GetIsPrototype() bool

GetIsPrototype returns state code.

func (*ObjectStateRecord) GetMemory added in v0.6.1

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 added in v0.6.1

func DeserializeRecord(buf []byte) Record

DeserializeRecord returns record decoded from bytes.

type Request added in v0.5.0

type Request interface {
	Record
	GetPayload() []byte
}

Request extends Record interface with GetPayload method.

type ResultRecord

type ResultRecord struct {
	Request core.RecordRef
	Payload []byte
}

ResultRecord represents result of a VM method.

func (ResultRecord) Type added in v0.6.2

func (ResultRecord) Type() TypeID

Type implementation of Record interface.

func (*ResultRecord) WriteHashData added in v0.6.2

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 added in v0.6.2

type SideEffectRecord struct {
	Domain  core.RecordRef
	Request core.RecordRef
}

SideEffectRecord is a record which is created in response to a request.

type State added in v0.6.2

type State int

State is a state of lifeline records.

type TypeID added in v0.0.2

type TypeID uint32

TypeID encodes a record object type.

func DeserializeType added in v0.6.1

func DeserializeType(buf []byte) TypeID

DeserializeType returns type from provided binary representation.

func (TypeID) String added in v0.6.3

func (i TypeID) String() string

type TypeRecord added in v0.0.5

type TypeRecord struct {
	SideEffectRecord

	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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL