istructs

package
v1.202405300917.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 6 Imported by: 2

README

codecov

core-istructs

Documentation

Index

Constants

View Source
const (
	// RecordID = RegisterID * RegisterFactor + BaseRecordID
	RegisterFactor = 5000000000

	// ClusterDBSer is used to generate cluster-side IDs
	// ID = PrimaryDCBaseID + some sequenced number
	ClusterAsRegisterID = 0xFFFF - 1000 + iota
	ClusterAsCRecordRegisterID
)

RecordID generation

View Source
const (
	NullClusterID = ClusterID(iota)
	MainClusterID
)
View Source
const (
	ClusterAppID_null = ClusterAppID(0) + iota
	ClusterAppID_sys_registry
	ClusterAppID_untill_airs_bp
	ClusterAppID_test1_app1
	ClusterAppID_test1_app2
	ClusterAppID_test2_app1
	ClusterAppID_test2_app2
	ClusterAppID_sys_blobber
	ClusterAppID_sys_router
	ClusterAppID_untill_resellerportal
	ClusterAppID_sys_cluster
	ClusterAppID_FakeLast
)
View Source
const AppQNameQualifierChar = "/"

AppQNameQualifierChar: char to separate application owner (provider) from application name

View Source
const DefaultNumAppWorkspaces = NumAppWorkspaces(10)
View Source
const FirstBaseAppWSID = MaxPseudoBaseWSID + 1

Application Workspaces

View Source
const FirstBaseRecordID = MaxReservedBaseRecordID + 1

This is the first value which must be returned by the IDGenerator (in the Command Processor) for the given workspace

View Source
const FirstBaseUserWSID = FirstBaseAppWSID + 0xffff

User Workspaces

View Source
const FirstGeneratedAppID = ClusterAppID(0x100)
View Source
const FirstOffset = Offset(1)
View Source
const FirstPseudoBaseWSID = NullWSID

Pseudo Workspaces

View Source
const FirstSingletonID = MinReservedBaseRecordID

Singleton - CDoc which has at most one record

View Source
const MaxClusterID = ClusterID(0xffff)
View Source
const MaxPseudoBaseWSID = WSID(0xffff)
View Source
const MaxRawRecordID = RecordID(0xffff)
View Source
const MaxReservedBaseRecordID = MinReservedBaseRecordID + 0xffff
View Source
const MaxSingletonID = FirstSingletonID + 0x1ff
View Source
const MinRawRecordID = RecordID(1)

MinRawRecordID and MaxRawRecordID: range bounds for "raw" RecordIDs which are generated by client and must be re-generated

View Source
const MinReservedBaseRecordID = MaxRawRecordID + 1
View Source
const NonExistingRecordID = MaxSingletonID + 1

Used to test behaviour on providing the unexisting record ID

View Source
const NullClusterAppID = ClusterAppID_null
View Source
const NullOffset = Offset(0)
View Source
const NullRecordID = RecordID(0)
View Source
const NullWSID = WSID(0)
View Source
const ReadToTheEnd = int(^uint(0) >> 1)

It is 0x7FFF_FFFF_FFFF_FFFF for x64 architecture, ref. https://play.golang.org/p/HBoCflcoERV Used by IEvents.Read* methods

View Source
const SysOwner = "sys"
View Source
const WSIDClusterLShift = 64 - 16 - 1

WSID = ClusterID << WSIDClusterLShift + NextWSID()

Variables

View Source
var (
	// QNameForError is a marker of error in log
	QNameForError = appdef.NewQName(appdef.SysPackage, "Error")

	// QNameCommand is used in core-irates
	QNameCommand = appdef.NewQName(appdef.SysPackage, "Command")

	// QNameQuery is used in core-irates
	QNameQuery = appdef.NewQName(appdef.SysPackage, "Query")

	QNameCommandCUD = appdef.NewQName(appdef.SysPackage, "CUD")

	// QNameRaw denotes that Function argument comes as a JSON object
	QNameRaw = appdef.NewQName(appdef.SysPackage, "Raw")

	QNameCDoc    = appdef.NewQName(appdef.SysPackage, "CDoc")
	QNameWDoc    = appdef.NewQName(appdef.SysPackage, "WDoc")
	QNameODoc    = appdef.NewQName(appdef.SysPackage, "ODoc")
	QNameCRecord = appdef.NewQName(appdef.SysPackage, "CRecord")
	QNameWRecord = appdef.NewQName(appdef.SysPackage, "WRecord")
	QNameORecord = appdef.NewQName(appdef.SysPackage, "ORecord")
)
View Source
var AppQName_null = NullAppQName
View Source
var AppQName_sys_blobber = NewAppQName(SysOwner, "blobber")
View Source
var AppQName_sys_cluster = NewAppQName(SysOwner, "cluster")
View Source
var AppQName_sys_registry = NewAppQName(SysOwner, "registry")
View Source
var AppQName_sys_router = NewAppQName(SysOwner, "router") // For ACME certificates
View Source
var AppQName_test1_app1 = NewAppQName("test1", "app1")
View Source
var AppQName_test1_app2 = NewAppQName("test1", "app2")
View Source
var AppQName_test2_app1 = NewAppQName("test2", "app1")
View Source
var AppQName_test2_app2 = NewAppQName("test2", "app2")
View Source
var AppQName_untill_airs_bp = NewAppQName("untill", "airs-bp")
View Source
var AppQName_untill_resellerportal = NewAppQName("untill", "resellerportal")
View Source
var ErrAppNotFound = errors.New("application not found")
View Source
var MinClusterRecordID = NewRecordID(NullRecordID)

NullAppQName is undefined (or empty) application name

Functions

This section is empty.

Types

type AppQName

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

AppQName is unique in cluster federation <owner>/<name> sys/registry unTill/airs-bp test1/app1 test1/app2 test2/app1 test2/app2 Ref. utils.go for methods

func MustParseAppQName

func MustParseAppQName(val string) AppQName

func NewAppQName

func NewAppQName(owner, name string) AppQName

func ParseAppQName

func ParseAppQName(val string) (res AppQName, err error)

func (AppQName) IsSys

func (aqn AppQName) IsSys() bool

func (*AppQName) MarshalJSON

func (aqn *AppQName) MarshalJSON() ([]byte, error)

func (AppQName) MarshalText

func (aqn AppQName) MarshalText() (text []byte, err error)

need to marshal map[AppQName]any

func (*AppQName) Name

func (aqn *AppQName) Name() string

func (*AppQName) Owner

func (aqn *AppQName) Owner() string

func (AppQName) String

func (aqn AppQName) String() string

func (*AppQName) UnmarshalJSON

func (aqn *AppQName) UnmarshalJSON(text []byte) (err error)

func (*AppQName) UnmarshalText

func (aqn *AppQName) UnmarshalText(text []byte) (err error)

need to unmarshal map[AppQName]any golang json looks on UnmarshalText presence only on unmarshal map[QName]any. UnmarshalJSON() will be used anyway but no UnmarshalText -> fail to unmarshal map[AppQName]any see https://github.com/golang/go/issues/29732

type CUDValidator

type CUDValidator struct {
	Match    ValidatorMatchFunc
	Validate func(ctx context.Context, appStructs IAppStructs, cudRow ICUDRow, wsid WSID, cmdQName appdef.QName) error
}

type ClusterAppID

type ClusterAppID = uint32

Unique per cluster (Different clusters might have different ID for the same App) 2^32 apps per clusters

type ClusterID

type ClusterID = uint16

type CommandPrepareArgs

type CommandPrepareArgs struct {
	PrepareArgs
	ArgumentUnloggedObject IObject
}

type ConnectedDeviceID

type ConnectedDeviceID uint16

Should be named as ConnectedRegisterID

type EventValidator

type EventValidator func(ctx context.Context, rawEvent IRawEvent, appStructs IAppStructs, wsid WSID) error

type ExecCommandArgs

type ExecCommandArgs struct {
	CommandPrepareArgs
	State   IState
	Intents IIntents
}

type ExecQueryArgs

type ExecQueryArgs struct {
	PrepareArgs
	State IState
}

type ExecQueryCallback

type ExecQueryCallback func(object IObject) error

type GenericPayload

type GenericPayload struct {
	AppQName AppQName
	Duration time.Duration
	IssuedAt time.Time
}

All payloads must inherit this payload

type GenericRawEventBuilderParams

type GenericRawEventBuilderParams struct {

	// Bytes from which events are built
	// If error happens these bytes are stored and returned as part of the IDbEvent.Error() result
	EventBytes []byte

	HandlingPartition PartitionID
	PLogOffset        Offset
	Workspace         WSID
	WLogOffset        Offset

	QName appdef.QName

	RegisteredAt UnixMilli
}

type IAbstractEvent

type IAbstractEvent interface {

	// If event contains error QName is consts.QNameForError
	// Otherwise is taken from params
	QName() appdef.QName

	ArgumentObject() IObject

	CUDs(cb func(rec ICUDRow))

	RegisteredAt() UnixMilli
	Synced() bool

	DeviceID() ConnectedDeviceID
	SyncedAt() UnixMilli
}

type IAppStructs

type IAppStructs interface {
	Events() IEvents

	Records() IRecords

	ViewRecords() IViewRecords

	ObjectBuilder(appdef.QName) IObjectBuilder

	// Working with resources like functions, images (in the future)
	// Function can be inside WASM, container, executable, jar, zip etc.
	Resources() IResources

	// AppDef
	AppDef() appdef.IAppDef

	ClusterAppID() ClusterAppID
	AppQName() AppQName

	IsFunctionRateLimitsExceeded(funcQName appdef.QName, wsid WSID) bool

	// Describe package names
	DescribePackageNames() []string

	// Describe package content
	DescribePackage(pkgName string) interface{}

	SyncProjectors() Projectors
	AsyncProjectors() Projectors

	CUDValidators() []CUDValidator
	EventValidators() []EventValidator

	NumAppWorkspaces() NumAppWorkspaces

	AppTokens() IAppTokens
}

type IAppStructsProvider

type IAppStructsProvider interface {
	// ErrAppNotFound can be returned
	// @ConcurrentAccess
	AppStructs(aqn AppQName) (structs IAppStructs, err error)

	AppStructsByDef(aqn AppQName, appDef appdef.IAppDef) (structs IAppStructs, err error)
}

Structs can be changed on-the-fly, so AppStructs() are taken for each message (request) to be handled

type IAppTokens

type IAppTokens interface {
	// Calls istructs.IssueToken for given App
	IssueToken(duration time.Duration, pointerToPayload interface{}) (token string, err error)
	// ErrTokenIssuedForAnotherApp is returned (check using errors.Is(...)) when token is issued for another application
	ValidateToken(token string, pointerToPayload interface{}) (gp GenericPayload, err error)
}

Same as itokens.ITokens but works for App specified in IAppTokensFactory App is configured per interface instance placed here because otherwise IAppStructs.AppTokens() would depend on itokens-payloads

type ICRecord

type ICRecord interface {
	IEditableRecord
}

type ICUD

type ICUD interface {
	// Container argument can be empty for root records (documents)
	Create(qName appdef.QName) IRowWriter

	// Only record's ID and QName will be kept in the resulting event
	// It is possible to submit NullRecord (when record not found)
	Update(record IRecord) IRowWriter
}

type ICUDRow

type ICUDRow interface {
	IRowReader
	IsNew() bool
	QName() appdef.QName
	ID() RecordID
	ModifiedFields(cb func(fieldName appdef.FieldName, newValue interface{}))
}

type ICommandFunction

type ICommandFunction interface {
	IFunction
	Exec(args ExecCommandArgs) error
}

type IDType

type IDType uint64

type IDbEvent

type IDbEvent interface {
	IAbstractEvent

	// originalQName is a string which potentially contains QName representation
	// May be in a form which is not possible to convert to QName
	Error() IEventError
}

What is kept in database

type IEditableRecord

type IEditableRecord interface {
	IRecord
	IsActive() bool
}

type IEventError

type IEventError interface {
	ErrStr() string
	QNameFromParams() appdef.QName

	// If true event data can be taken from I*Event fields
	ValidEvent() bool

	// Original bytes the event was deserialized from
	// nil if ValidEvent == true
	// Function with unlogged params can have ValidEvent == false and EventBytes == nil
	// DO NOT CHANGE
	OriginalEventBytes() []byte
}

type IEvents

type IEvents interface {
	GetSyncRawEventBuilder(params SyncRawEventBuilderParams) IRawEventBuilder
	GetNewRawEventBuilder(params NewRawEventBuilderParams) IRawEventBuilder

	// @ConcurrentAccess RW
	// buildOrValidationErr taken either BuildRawEvent() or from extra validation
	//
	// Raw event `ev` valid until `event.Release()`
	PutPlog(ev IRawEvent, buildOrValidationErr error, generator IIDGenerator) (event IPLogEvent, saveErr error)

	// @ConcurrentAccess RW
	PutWlog(IPLogEvent) error

	// @ConcurrentAccess R
	// consts.ReadToTheEnd can be used for the toReadCount parameter
	ReadPLog(ctx context.Context, partition PartitionID, offset Offset, toReadCount int, cb PLogEventsReaderCallback) (err error)
	ReadWLog(ctx context.Context, workspace WSID, offset Offset, toReadCount int, cb WLogEventsReaderCallback) (err error)
}

type IFunction

type IFunction interface {
	IResource
}

type IGRecord

type IGRecord interface {
	IEditableRecord
}

type IIDGenerator

type IIDGenerator interface {
	NextID(rawID RecordID, t appdef.IType) (storageID RecordID, err error)
	UpdateOnSync(syncID RecordID, t appdef.IType)
}

type IIntents

type IIntents interface {
	// NewValue returns a new value builder for given get
	// If a value with the same get already exists in storage, it will be replaced
	NewValue(key IStateKeyBuilder) (builder IStateValueBuilder, err error)

	// UpdateValue returns a value builder to update existing value
	UpdateValue(key IStateKeyBuilder, existingValue IStateValue) (builder IStateValueBuilder, err error)

	// returns nil when not found
	FindIntent(key IStateKeyBuilder) IStateValueBuilder
}

type IKey

type IKey interface {
	IRowReader
}

type IKeyBuilder

type IKeyBuilder interface {
	IRowWriter
	PartitionKey() IRowWriter
	ClusteringColumns() IRowWriter
	// Equals returns is src key builder has the same QName and field values. See #!21906
	Equals(src IKeyBuilder) bool

	// Puts key to bytes for specified workspace id
	//
	// Returns error if there were errors when calling Put-methods
	ToBytes(WSID) (pk, cc []byte, err error)
}

ref. also https://cassandra.apache.org/doc/latest/cassandra/cql/ddl.html FIXME implement IRowWriter

type IORecord

type IORecord interface {
	IRecord
}

type IObject

type IObject interface {
	IRowReader

	QName() appdef.QName

	// Children in given container
	//
	// if container is empty string then enums all children
	Children(container string, cb func(IObject))

	// First level qname-s
	Containers(func(string))

	// Does NOT panic if it is not actually IRecord
	// Just a wrapper which uses consts.SystemField*
	// If element does not have some IRecord-related field, panic occurs when the field is read
	AsRecord() IRecord
}

func NewNullObject

func NewNullObject() IObject

type IObjectBuilder

type IObjectBuilder interface {
	IRowWriter

	// Fill object from JSON
	FillFromJSON(map[string]any)

	// Build child for nested container
	ChildBuilder(containerName string) IObjectBuilder

	// Function validates object structure
	Build() (object IObject, err error)
}

func NewNullObjectBuilder

func NewNullObjectBuilder() IObjectBuilder

type IPLogEvent

type IPLogEvent interface {
	IDbEvent
	Workspace() WSID
	WLogOffset() Offset
	Release()
}

What is kept in database

type IPkgNameResolver

type IPkgNameResolver interface {
	// Returns package path by package local name.
	//
	// Returns empty string if not found
	PackageFullPath(localName string) string

	// Returns package local name by package path.
	//
	// Returns empty string if not found
	PackageLocalName(fullPath string) string
}

type IQueryFunction

type IQueryFunction interface {
	IFunction
	// panics if created by not NewQueryFunctionCustomResult(). Actually needed for q.sys.Collection only
	ResultType(args PrepareArgs) appdef.QName
	Exec(ctx context.Context, args ExecQueryArgs, callback ExecQueryCallback) error
}

type IRawEvent

type IRawEvent interface {
	IAbstractEvent
	ArgumentUnloggedObject() IObject

	HandlingPartition() PartitionID
	PLogOffset() Offset
	Workspace() WSID
	WLogOffset() Offset
}

type IRawEventBuilder

type IRawEventBuilder interface {

	// For sys.CUD command it is not called
	ArgumentObjectBuilder() IObjectBuilder
	ArgumentUnloggedObjectBuilder() IObjectBuilder

	CUDBuilder() ICUD

	// Must be last call to IRawEventBuilder
	// If err is not nil IRawEvent contains event with error
	BuildRawEvent() (raw IRawEvent, buildError error)
}

type IRecord

type IRecord interface {
	IRowReader
	QName() appdef.QName
	ID() RecordID

	// NullRecordID for documents
	Parent() RecordID

	// Container is empty for documents
	Container() string
}

Base abstract record

type IRecords

type IRecords interface {
	// Apply all CUDs, ODocs and WDocs from the given IPLogEvent
	// @ConcurrentAccess RW
	// Panics if event is not valid
	Apply(event IPLogEvent) (err error)

	// cb gets new version of each record affected by CUDs
	// Panics if event is not valid
	Apply2(event IPLogEvent, cb func(r IRecord)) (err error)

	// @ConcurrentAccess RW
	//
	// Record system fields sys.QName and sys.ID should be filled.
	// Data type name in sys.QName should be storable record type.
	// Record ID in sys.ID should not be a raw ID.
	//
	// Attention! This method does not perform a full validation of the recorded data :
	// - The values of referenced record IDs are not checked
	// - The fullness of the required fields is not checked
	PutJSON(WSID, map[appdef.FieldName]any) error

	// @ConcurrentAccess R
	// Can read GDoc, CDoc, ODoc, WDoc records
	// If record not found NullRecord with QName() == NullQName is returned
	// NullRecord.WSID & ID will be taken from arguments
	Get(workspace WSID, highConsistency bool, id RecordID) (record IRecord, err error)

	GetBatch(workspace WSID, highConsistency bool, ids []RecordGetBatchItem) (err error)

	// @ConcurrentAccess R
	// qName must be a singleton
	// If record not found NullRecord with QName() == NullQName is returned
	GetSingleton(workspace WSID, qName appdef.QName) (record IRecord, err error)
}

type IResource

type IResource interface {
	// Ref. ResourceKind_* constants
	Kind() ResourceKindType
	QName() appdef.QName
}

type IResources

type IResources interface {

	// If resource not found then {ResourceKind_null, QNameForNullResource) is returned
	// Currently resources are ICommandFunction and IQueryFunction
	QueryResource(resource appdef.QName) (r IResource)

	// Enumerates all application resources
	Resources(func(resName appdef.QName))
}

type IRowReader

type IRowReader interface {
	AsInt32(appdef.FieldName) int32
	AsInt64(appdef.FieldName) int64
	AsFloat32(appdef.FieldName) float32
	AsFloat64(appdef.FieldName) float64

	// Returns bytes or raw field value
	AsBytes(appdef.FieldName) []byte

	// Returns string or raw field value
	AsString(appdef.FieldName) string

	AsQName(appdef.FieldName) appdef.QName
	AsBool(appdef.FieldName) bool
	AsRecordID(appdef.FieldName) RecordID

	// consts.NullRecord will be returned as null-values
	RecordIDs(includeNulls bool, cb func(appdef.FieldName, RecordID))
	FieldNames(cb func(appdef.FieldName))
}

panics if name does not exist in type If field is nil zero value is returned

type IRowWriter

type IRowWriter interface {
	PutInt32(appdef.FieldName, int32)
	PutInt64(appdef.FieldName, int64)
	PutFloat32(appdef.FieldName, float32)
	PutFloat64(appdef.FieldName, float64)

	// Puts value into bytes or raw data field.
	PutBytes(appdef.FieldName, []byte)

	// Puts value into string or raw data field.
	PutString(appdef.FieldName, string)

	PutQName(appdef.FieldName, appdef.QName)
	PutBool(appdef.FieldName, bool)
	PutRecordID(appdef.FieldName, RecordID)

	// Puts value into int23, int64, float32, float64 or RecordID data type fields.
	//
	// Tries to make conversion from value to a name type
	PutNumber(appdef.FieldName, float64)

	// Puts value into string, bytes or QName data type field.
	//
	// Tries to make conversion from value to a name type
	PutChars(appdef.FieldName, string)

	// Puts value into fields. Field names are taken from map keys, values are taken from map values.
	//
	// Calls PutNumber for numbers and RecordIDs, PutChars for strings, bytes and QNames.
	PutFromJSON(map[appdef.FieldName]any)
}

type IState

type IState interface {
	// NewKey returns a Key builder for specified storage and entity name
	KeyBuilder(storage, entity appdef.QName) (builder IStateKeyBuilder, err error)

	CanExist(key IStateKeyBuilder) (value IStateValue, ok bool, err error)

	CanExistAll(keys []IStateKeyBuilder, callback StateValueCallback) (err error)

	MustExist(key IStateKeyBuilder) (value IStateValue, err error)

	MustExistAll(keys []IStateKeyBuilder, callback StateValueCallback) (err error)

	MustNotExist(key IStateKeyBuilder) (err error)

	MustNotExistAll(keys []IStateKeyBuilder) (err error)

	// Read reads all values according to the get and return them in callback
	Read(key IStateKeyBuilder, callback ValueCallback) (err error)

	// For projectors
	PLogEvent() IPLogEvent

	App() AppQName
}

type IStateKeyBuilder

type IStateKeyBuilder interface {
	IKeyBuilder
	Storage() appdef.QName
	Entity() appdef.QName
}

type IStateValue

type IStateValue interface {
	IValue
	AsValue(name string) IStateValue
	Length() int
	GetAsString(index int) string
	GetAsBytes(index int) []byte
	GetAsInt32(index int) int32
	GetAsInt64(index int) int64
	GetAsFloat32(index int) float32
	GetAsFloat64(index int) float64
	GetAsQName(index int) appdef.QName
	GetAsBool(index int) bool
	GetAsValue(index int) IStateValue
}

type IStateValueBuilder

type IStateValueBuilder interface {
	IValueBuilder
	BuildValue() IStateValue
	Equal(to IStateValueBuilder) bool // used in TestState
}

type IValue

type IValue interface {
	IRowReader

	AsRecord(appdef.FieldName) IRecord
	AsEvent(appdef.FieldName) IDbEvent
}

@Tricky

type IValueBuilder

type IValueBuilder interface {
	IRowWriter

	// @Tricky
	PutRecord(appdef.FieldName, IRecord)

	// @Tricky
	PutEvent(appdef.FieldName, IDbEvent)
	Build() IValue

	// Writes value data to bytes.
	//
	// Returns error if there were errors when calling Put-methods
	ToBytes() ([]byte, error)
}

type IViewRecords

type IViewRecords interface {
	KeyBuilder(view appdef.QName) IKeyBuilder
	NewValueBuilder(view appdef.QName) IValueBuilder
	UpdateValueBuilder(view appdef.QName, existing IValue) IValueBuilder

	// All key fields must be specified (panic)
	// Key & value must be from the same QName (panic)
	Put(workspace WSID, key IKeyBuilder, value IValueBuilder) (err error)

	PutBatch(workspace WSID, batch []ViewKV) (err error)

	// @ConcurrentAccess RW
	//
	// View name should be passed in sys.QName field.
	// All key fields should be filled.
	//
	// Attention! This method does not perform a full validation of the recorded data :
	// - The values of referenced record IDs are not checked
	// - The fullness of the required view value fields is not checked
	PutJSON(WSID, map[appdef.FieldName]any) error

	// All fields must be filled in in the key (panic otherwise)
	Get(workspace WSID, key IKeyBuilder) (value IValue, err error)

	GetBatch(workspace WSID, kv []ViewRecordGetBatchItem) (err error)

	// All fields of key.PartitionKey MUST be specified (panic)
	// Zero or more fields of key.ClusteringColumns can be specified
	// If last clustering column has variable length it can be filled partially
	Read(ctx context.Context, workspace WSID, key IKeyBuilder, cb ValuesCallback) (err error)
}

type IWLogEvent

type IWLogEvent interface {
	IDbEvent
	Release()
}

type NewRawEventBuilderParams

type NewRawEventBuilderParams struct {
	GenericRawEventBuilderParams
}

type NullObject

type NullObject struct{ NullRowReader }

Implements IObject

func (*NullObject) AsRecord

func (no *NullObject) AsRecord() IRecord

func (*NullObject) Children

func (*NullObject) Children(container string, cb func(IObject))

func (*NullObject) Container

func (no *NullObject) Container() string

func (*NullObject) Containers

func (*NullObject) Containers(func(string))

func (*NullObject) FieldNames

func (no *NullObject) FieldNames(func(string))

func (*NullObject) ID

func (no *NullObject) ID() RecordID

func (*NullObject) Parent

func (no *NullObject) Parent() RecordID

func (*NullObject) QName

func (*NullObject) QName() appdef.QName

type NullObjectBuilder

type NullObjectBuilder struct{ NullRowWriter }

Implements IObjectBuilder

func (*NullObjectBuilder) Build

func (*NullObjectBuilder) Build() (IObject, error)

func (*NullObjectBuilder) ChildBuilder

func (*NullObjectBuilder) ChildBuilder(string) IObjectBuilder

func (*NullObjectBuilder) FillFromJSON

func (*NullObjectBuilder) FillFromJSON(map[string]any)

type NullRowReader

type NullRowReader struct{}

Implements IRowReader

func (*NullRowReader) AsBool

func (*NullRowReader) AsBool(name string) bool

func (*NullRowReader) AsBytes

func (*NullRowReader) AsBytes(name string) []byte

func (*NullRowReader) AsFloat32

func (*NullRowReader) AsFloat32(name string) float32

func (*NullRowReader) AsFloat64

func (*NullRowReader) AsFloat64(name string) float64

func (*NullRowReader) AsInt32

func (*NullRowReader) AsInt32(name string) int32

func (*NullRowReader) AsInt64

func (*NullRowReader) AsInt64(name string) int64

func (*NullRowReader) AsQName

func (*NullRowReader) AsQName(name string) appdef.QName

func (*NullRowReader) AsRecordID

func (*NullRowReader) AsRecordID(name string) RecordID

func (*NullRowReader) AsString

func (*NullRowReader) AsString(name string) string

func (*NullRowReader) RecordIDs

func (*NullRowReader) RecordIDs(includeNulls bool, cb func(name string, value RecordID))

type NullRowWriter

type NullRowWriter struct{}

Implements IRowWriter

func (*NullRowWriter) PutBool

func (*NullRowWriter) PutBool(string, bool)

func (*NullRowWriter) PutBytes

func (*NullRowWriter) PutBytes(string, []byte)

func (*NullRowWriter) PutChars

func (*NullRowWriter) PutChars(string, string)

func (*NullRowWriter) PutFloat32

func (*NullRowWriter) PutFloat32(string, float32)

func (*NullRowWriter) PutFloat64

func (*NullRowWriter) PutFloat64(string, float64)

func (*NullRowWriter) PutFromJSON

func (*NullRowWriter) PutFromJSON(map[string]any)

func (*NullRowWriter) PutInt32

func (*NullRowWriter) PutInt32(string, int32)

func (*NullRowWriter) PutInt64

func (*NullRowWriter) PutInt64(string, int64)

func (*NullRowWriter) PutNumber

func (*NullRowWriter) PutNumber(string, float64)

func (*NullRowWriter) PutQName

func (*NullRowWriter) PutQName(string, appdef.QName)

func (*NullRowWriter) PutRecordID

func (*NullRowWriter) PutRecordID(string, RecordID)

func (*NullRowWriter) PutString

func (*NullRowWriter) PutString(string, string)

type NumAppPartitions

type NumAppPartitions int

type NumAppWorkspaces

type NumAppWorkspaces int

type NumCommandProcessors

type NumCommandProcessors int

type NumQueryProcessors

type NumQueryProcessors int

type Offset

type Offset IDType

type PLogEventsReaderCallback

type PLogEventsReaderCallback func(plogOffset Offset, event IPLogEvent) (err error)

It's desirable but not necessary to call event.Release() after event using

type PartitionID

type PartitionID uint16

type PrepareArgs

type PrepareArgs struct {
	Workpiece      interface{}
	ArgumentObject IObject
	WSID           WSID
	Workspace      appdef.IWorkspace
}

type Projector

type Projector struct {
	Name appdef.QName
	Func func(event IPLogEvent, state IState, intents IIntents) (err error)
}

type Projectors

type Projectors map[appdef.QName]Projector

type RateLimit

type RateLimit struct {
	Period                time.Duration
	MaxAllowedPerDuration uint32
}

type RateLimitKind

type RateLimitKind uint8
const (
	RateLimitKind_byApp RateLimitKind = iota
	RateLimitKind_byWorkspace
	RateLimitKind_byID

	RateLimitKind_FakeLast
)

func (RateLimitKind) MarshalText

func (k RateLimitKind) MarshalText() ([]byte, error)

func (RateLimitKind) String

func (i RateLimitKind) String() string

type RecordGetBatchItem

type RecordGetBatchItem struct {
	ID     RecordID // in
	Record IRecord  // out
}

type RecordID

type RecordID IDType

func NewCDocCRecordID

func NewCDocCRecordID(baseID RecordID) RecordID

Used to generate IDs for CDoc/CRecord

func NewRecordID

func NewRecordID(baseID RecordID) RecordID

func (RecordID) BaseRecordID

func (id RecordID) BaseRecordID() RecordID

func (RecordID) IsRaw

func (id RecordID) IsRaw() bool

RecordID.IsRaw: returns true if ID is temporary

type ResourceKindType

type ResourceKindType uint8
const (
	ResourceKind_null ResourceKindType = iota
	ResourceKind_CommandFunction
	ResourceKind_QueryFunction
	ResourceKind_FakeLast
)

func (ResourceKindType) MarshalText

func (k ResourceKindType) MarshalText() ([]byte, error)

func (ResourceKindType) String

func (i ResourceKindType) String() string

type StateValueCallback

type StateValueCallback func(key IKeyBuilder, value IStateValue, ok bool) (err error)

type SubjectKindType

type SubjectKindType uint8
const (
	SubjectKind_null SubjectKindType = iota
	SubjectKind_User
	SubjectKind_Device
	SubjectKind_FakeLast
)

type SubjectLogin

type SubjectLogin string

type SyncRawEventBuilderParams

type SyncRawEventBuilderParams struct {
	GenericRawEventBuilderParams
	Device   ConnectedDeviceID
	SyncedAt UnixMilli
}

type UnixMilli

type UnixMilli int64

time.Now().UnixMilli()

func (UnixMilli) String

func (um UnixMilli) String() string

type ValidatorMatchFunc

type ValidatorMatchFunc func(cud ICUDRow, wsid WSID, cmdQName appdef.QName) bool

type ValueCallback

type ValueCallback func(key IKey, value IStateValue) (err error)

type ValuesCallback

type ValuesCallback func(key IKey, value IValue) (err error)

type ViewKV

type ViewKV struct {
	Key   IKeyBuilder
	Value IValueBuilder
}

type ViewRecordGetBatchItem

type ViewRecordGetBatchItem struct {
	Key   IKeyBuilder // in
	Ok    bool        // out
	Value IValue      // out
}

type WLogEventsReaderCallback

type WLogEventsReaderCallback func(wlogOffset Offset, event IWLogEvent) (err error)

It's desirable but not necessary to call event.Release() after event using

type WSID

type WSID IDType

func NewWSID

func NewWSID(cluster ClusterID, baseWSID WSID) WSID

func (WSID) BaseWSID

func (wsid WSID) BaseWSID() WSID

func (WSID) ClusterID

func (wsid WSID) ClusterID() ClusterID

Jump to

Keyboard shortcuts

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