record

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2018 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package record contains various record type definitions.

Index

Constants

View Source
const (
	// HashSize is a record hash size. We use 256-bit SHA-3 hash.
	HashSize = 32
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivationRecord

type ActivationRecord struct {
	StatefulResult

	GoverningDomain Reference
}

ActivationRecord is an activation record.

type AmendRecord

type AmendRecord struct {
	StatefulResult

	BaseRecord    Reference
	AmendedRecord Reference
}

AmendRecord is produced when we modify another record in ledger.

type AppDataRecord

type AppDataRecord struct {
	// contains filtered or unexported fields
}

AppDataRecord is persistent data record stored in ledger.

func (*AppDataRecord) Hash

func (r *AppDataRecord) Hash() Hash

Hash returns SHA-3 hash sum of Record

func (*AppDataRecord) TimeSlot

func (r *AppDataRecord) TimeSlot() uint64

TimeSlot returns time slot number that Record belongs to.

func (*AppDataRecord) Type

func (r *AppDataRecord) Type() Type

Type returns Record type.

type CallRequest

type CallRequest struct {
	RequestRecord
	// contains filtered or unexported fields
}

CallRequest is a contract execution request. Implements io.ReadWriter interface.

func (*CallRequest) CallInterface

func (r *CallRequest) CallInterface() Reference

CallInterface is a call interface address.

func (*CallRequest) CallMethod

func (r *CallRequest) CallMethod() uint

CallMethod is a contract method number to call.

func (*CallRequest) Read

func (r *CallRequest) Read(p []byte) (n int, err error)

Read allows to read Request's paramMemory.

func (*CallRequest) Write

func (r *CallRequest) Write(p []byte) (n int, err error)

Write allows to write to Request's paramMemory.

type ClassActivateRecord

type ClassActivateRecord struct {
	ActivationRecord

	CodeRecord    Reference
	DefaultMemory Memory
}

ClassActivateRecord is produced when we "activate" new contract class.

type ClassAmendRecord

type ClassAmendRecord struct {
	AmendRecord

	NewCode []byte // ObjectBinaryCode
}

ClassAmendRecord is an amendment record for classes.

func (*ClassAmendRecord) MigrationCodes

func (r *ClassAmendRecord) MigrationCodes() []*MemoryMigrationCode

MigrationCodes returns a list of data migration procedures for a given code change.

type CodeRecord

type CodeRecord struct {
	StorageRecord

	Interfaces   []Reference
	TargetedCode [][]byte // []MachineBinaryCode
	SourceCode   string   // ObjectSourceCode
}

CodeRecord is a code storage record.

type DeactivationRecord

type DeactivationRecord struct {
	AmendRecord
}

DeactivationRecord marks targeted object as disabled.

type EnforcedObjectAmendRecord

type EnforcedObjectAmendRecord struct {
	ObjectAmendRecord
}

EnforcedObjectAmendRecord is an enforced amendment record for objects.

type Hash

type Hash [HashSize]byte

Hash is hash sum of record, 32-byte array.

type LockUnlockRequest

type LockUnlockRequest struct {
	RequestRecord
	// contains filtered or unexported fields
}

LockUnlockRequest is a request to temporary lock (or unlock) another record.

func (*LockUnlockRequest) ExpectedLockDuration

func (r *LockUnlockRequest) ExpectedLockDuration() time.Duration

ExpectedLockDuration is expected time duration that record will be locked.

func (*LockUnlockRequest) Transaction

func (r *LockUnlockRequest) Transaction() Reference

Transaction is a Reference to Transaction record.

type LockUnlockResult

type LockUnlockResult struct {
	SpecialResult
}

LockUnlockResult is a result of lock/unlock attempts.

type Memory

type Memory []byte

Memory is actual contracts' state, variables etc.

type MemoryMigrationCode

type MemoryMigrationCode struct {
	ClassAmendRecord

	GeneratedByClassRecord Reference
	MigrationCodeRecord    Reference
}

MemoryMigrationCode is a data migration procedure.

type ObjectActivateRecord

type ObjectActivateRecord struct {
	ActivationRecord

	ClassActivateRecord Reference
	Memory              Memory
}

ObjectActivateRecord is produced when we instantiate new object from an available class.

type ObjectAmendRecord

type ObjectAmendRecord struct {
	AmendRecord

	NewMemory Memory
}

ObjectAmendRecord is an amendment record for objects.

type ObjectAppendRecord

type ObjectAppendRecord struct {
	AmendRecord

	AppendMemory Memory
}

ObjectAppendRecord is an "append state" record for objects. It does not contain full actual state.

type ProjectionType

type ProjectionType uint

ProjectionType is a "view filter" for record. E.g. we can read whole object or just it's hash.

type ReadObject

type ReadObject struct {
	ReadRequest
	// contains filtered or unexported fields
}

ReadObject is a request type

func (*ReadObject) ProjectionType

func (r *ReadObject) ProjectionType() ProjectionType

ProjectionType is a "view filter" for record. E.g. we can read whole object or just it's hash.

type ReadObjectComposite

type ReadObjectComposite struct {
	ReadObject
	// contains filtered or unexported fields
}

ReadObjectComposite is a request to read object including it's "injected" fields.

func (*ReadObjectComposite) CompositeType

func (r *ReadObjectComposite) CompositeType() Reference

CompositeType is reference to a Record describing composition type.

type ReadObjectResult

type ReadObjectResult struct {
	StatelessResult

	State            int
	MomoryProjection Memory
}

ReadObjectResult contains necessary object's memory.

type ReadRecordRequest

type ReadRecordRequest struct {
	ReadRequest
	// contains filtered or unexported fields
}

ReadRecordRequest is a request type to read another record.

func (*ReadRecordRequest) ExpectedRecordType

func (r *ReadRecordRequest) ExpectedRecordType() Type

ExpectedRecordType is an expected Type of target 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 ReasonCode

type ReasonCode uint

ReasonCode is an error reason code.

type Record

type Record interface {
	Hash() Hash
	TimeSlot() uint64
	Type() Type
}

Record is base interface for all records.

type Reference

type Reference interface {
	Record
}

Reference is a pointer that allows to address any record across whole network. TODO: Should implement normal Reference type (not interface) TODO: Globally unique record identifier must be found

type RejectionResult

type RejectionResult struct {
	SpecialResult
}

RejectionResult is a result type for failed attempts.

type RequestRecord

type RequestRecord struct {
	AppDataRecord
	// contains filtered or unexported fields
}

RequestRecord is common type for all requests.

func (*RequestRecord) Requester

func (r *RequestRecord) Requester() Reference

Requester is a request author's global address.

func (*RequestRecord) Target

func (r *RequestRecord) Target() Reference

Target is an address of contract that we want to execute, data that we want to get etc.

type ResultRecord

type ResultRecord struct {
	AppDataRecord

	RequestRecord Reference
}

ResultRecord is a common type for all results.

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
	// contains filtered or unexported fields
}

StatelessCallResult is a contract call result that didn't produce new state.

func (*StatelessCallResult) Read

func (r *StatelessCallResult) Read(p []byte) (n int, err error)

Read allows to read Result's resultMemory.

func (*StatelessCallResult) Write

func (r *StatelessCallResult) Write(p []byte) (n int, err error)

Write allows to write to Request's paramMemory.

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 Type

type Type uint

Type is record type.

type WipeOutRecord

type WipeOutRecord struct {
	ResultRecord

	Replacement Reference
	WipedHash   Hash
}

WipeOutRecord is a special record that takes place of another record when we need to completely wipe out some information from storage (think GDPR).

Jump to

Keyboard shortcuts

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