Documentation ¶
Overview ¶
* Copyright (c) 2021-present Sigma-Soft, Ltd. * @author: Nikolay Nikitin
Index ¶
- Constants
- Variables
- func GetFunctionRateLimitName(funcQName appdef.QName, rateLimitKind istructs.RateLimitKind) (res string)
- func IBucketsFromIAppStructs(as istructs.IAppStructs) irates.IBuckets
- func NewCommandFunction(name appdef.QName, exec ExecCommandClosure) istructs.ICommandFunction
- func NewIDGenerator() istructs.IIDGenerator
- func NewIDGeneratorWithHook(onNewID func(rawID, storageID istructs.RecordID, t appdef.IType) error) istructs.IIDGenerator
- func NewNullRecord(id istructs.RecordID) istructs.IRecord
- func NewQueryFunction(name appdef.QName, exec ExecQueryClosure) istructs.IQueryFunction
- func NewQueryFunctionCustomResult(name appdef.QName, resultFunc func(istructs.PrepareArgs) appdef.QName, ...) istructs.IQueryFunction
- func NullCommandExec(_ istructs.ExecCommandArgs) error
- func NullQueryExec(_ context.Context, _ istructs.ExecQueryArgs, _ istructs.ExecQueryCallback) error
- func Provide(appConfigs AppConfigsType, bucketsFactory irates.BucketsFactoryType, ...) (provider istructs.IAppStructsProvider)
- type AppConfigParams
- type AppConfigType
- func (cfg *AppConfigType) AddAsyncProjectors(pp ...istructs.Projector)
- func (cfg *AppConfigType) AddCUDValidators(cudValidators ...istructs.CUDValidator)
- func (cfg *AppConfigType) AddEventValidators(eventValidators ...istructs.EventValidator)
- func (cfg *AppConfigType) AddSyncProjectors(pp ...istructs.Projector)
- func (cfg *AppConfigType) AppDefBuilder() appdef.IAppDefBuilder
- func (cfg *AppConfigType) AsyncProjectors() istructs.Projectors
- func (cfg *AppConfigType) NumAppWorkspaces() istructs.NumAppWorkspaces
- func (cfg *AppConfigType) Prepared() bool
- func (cfg *AppConfigType) SetNumAppWorkspaces(naw istructs.NumAppWorkspaces)
- func (cfg *AppConfigType) SyncProjectors() istructs.Projectors
- type AppConfigsType
- type ExecCommandClosure
- type ExecQueryClosure
- type Resources
- type ValidateError
Constants ¶
const ( ECode_UnknownError = iota ECode_EmptyTypeName ECode_InvalidTypeName ECode_InvalidTypeKind ECode_EmptyData ECode_InvalidRecordID ECode_InvalidRefRecordID ECode_EEmptyCUDs ECode_InvalidChildName ECode_InvalidOccursMin ECode_InvalidOccursMax )
validate error codes, see ValidateError.Code()
const (
// events per application plog cache, see [#455](https://github.com/voedger/voedger/issues/455#:~:text=Currently%2C%2010000%20must%20be%20used)
DefaultPLogEventCacheSize = 10 * 1000
)
Application config
Variables ¶
var ErrAbstractType = errors.New("abstract type")
var ErrCUDsMissed = errors.New("CUDs are missed")
var ErrDataConstraintViolation = errors.New("data constraint violation")
var ErrFieldIsEmpty = errors.New("field is empty")
var ErrIDNotFound = errors.New("ID not found")
var ErrInvalidName = errors.New("name not valid")
var ErrInvalidVerificationKind = errors.New("invalid verification kind")
var ErrMaxGetBatchRecordCountExceeds = errors.New("the maximum count of records to batch is exceeded")
var ErrMaxOccursViolation = errors.New("maximum occurs violated")
var ErrMinOccursViolation = errors.New("minimum occurs violated")
var ErrNameMissed = errors.New("name is empty")
var ErrNameNotFound = errors.New("name not found")
var ErrNumAppWorkspacesNotSet = errors.New("NumAppWorkspaces is not set")
var ErrRawRecordIDRequired = errors.New("raw record ID required")
var ErrRawRecordIDUnexpected = errors.New("unexpected raw record ID")
var ErrRecordIDNotFound = fmt.Errorf("recordID cannot be found: %w", ErrIDNotFound)
var ErrRecordIDUniqueViolation = errors.New("record ID duplicates")
var ErrRecordNotFound = errors.New("record cannot be found")
var ErrTypeChanged = errors.New("type has been changed")
var ErrUnableToUpdateSystemField = errors.New("unable to update system field")
var ErrUnexpectedTypeKind = errors.New("unexpected type kind")
var ErrUnknownCodec = errors.New("unknown codec")
var ErrWrongFieldType = errors.New("wrong field type")
var ErrWrongRecordID = errors.New("wrong record ID")
var ErrWrongType = errors.New("wrong type")
var ErrorEventNotValid = errors.New("event is not valid")
var MatchAll = func(_ appdef.QName, _ istructs.WSID, _ appdef.QName) bool { return true }
var NullAppConfig = newAppConfig(istructs.AppQName_null, appdef.New())
Functions ¶
func GetFunctionRateLimitName ¶
func GetFunctionRateLimitName(funcQName appdef.QName, rateLimitKind istructs.RateLimitKind) (res string)
func IBucketsFromIAppStructs ¶
func IBucketsFromIAppStructs(as istructs.IAppStructs) irates.IBuckets
func NewCommandFunction ¶
func NewCommandFunction(name appdef.QName, exec ExecCommandClosure) istructs.ICommandFunction
NewCommandFunction creates and returns new command function
func NewIDGenerator ¶
func NewIDGenerator() istructs.IIDGenerator
func NewIDGeneratorWithHook ¶
func NewIDGeneratorWithHook(onNewID func(rawID, storageID istructs.RecordID, t appdef.IType) error) istructs.IIDGenerator
used in tests
func NewQueryFunction ¶
func NewQueryFunction(name appdef.QName, exec ExecQueryClosure) istructs.IQueryFunction
Creates and returns new query function
func NewQueryFunctionCustomResult ¶
func NewQueryFunctionCustomResult(name appdef.QName, resultFunc func(istructs.PrepareArgs) appdef.QName, exec ExecQueryClosure) istructs.IQueryFunction
func NullCommandExec ¶
func NullCommandExec(_ istructs.ExecCommandArgs) error
NullCommandExec is null execute action closure for command functions
func NullQueryExec ¶
func NullQueryExec(_ context.Context, _ istructs.ExecQueryArgs, _ istructs.ExecQueryCallback) error
Null execute action closure for query functions
func Provide ¶
func Provide(appConfigs AppConfigsType, bucketsFactory irates.BucketsFactoryType, appTokensFactory payloads.IAppTokensFactory, storageProvider istorage.IAppStorageProvider) (provider istructs.IAppStructsProvider)
Provide: constructs new application structures provider
Types ¶
type AppConfigParams ¶
type AppConfigParams struct { // PLog events cache size. // // Default value is DefaultPLogEventCacheSize (10’000 events). // Zero (0) means that cache will not be used PLogEventCacheSize int }
Application configuration parameters
type AppConfigType ¶
type AppConfigType struct { Name istructs.AppQName ClusterAppID istructs.ClusterAppID AppDef appdef.IAppDef Resources Resources // Application configuration parameters Params AppConfigParams FunctionRateLimits functionRateLimits // contains filtered or unexported fields }
AppConfigType: configuration for application workflow
func (*AppConfigType) AddAsyncProjectors ¶
func (cfg *AppConfigType) AddAsyncProjectors(pp ...istructs.Projector)
func (*AppConfigType) AddCUDValidators ¶
func (cfg *AppConfigType) AddCUDValidators(cudValidators ...istructs.CUDValidator)
func (*AppConfigType) AddEventValidators ¶
func (cfg *AppConfigType) AddEventValidators(eventValidators ...istructs.EventValidator)
func (*AppConfigType) AddSyncProjectors ¶
func (cfg *AppConfigType) AddSyncProjectors(pp ...istructs.Projector)
func (*AppConfigType) AppDefBuilder ¶
func (cfg *AppConfigType) AppDefBuilder() appdef.IAppDefBuilder
need to build view.sys.NextBaseWSID and view.sys.projectionOffsets could be called on application build stage only
func (*AppConfigType) AsyncProjectors ¶
func (cfg *AppConfigType) AsyncProjectors() istructs.Projectors
func (*AppConfigType) NumAppWorkspaces ¶
func (cfg *AppConfigType) NumAppWorkspaces() istructs.NumAppWorkspaces
func (*AppConfigType) Prepared ¶
func (cfg *AppConfigType) Prepared() bool
Returns is application configuration prepared
func (*AppConfigType) SetNumAppWorkspaces ¶
func (cfg *AppConfigType) SetNumAppWorkspaces(naw istructs.NumAppWorkspaces)
must be called after creating the AppConfigType because app will provide the deployment descriptor with the actual NumAppWorkspaces after willing the AppConfigType so fisrt create AppConfigType, use it on app provide, then set the actual NumAppWorkspaces
func (*AppConfigType) SyncProjectors ¶
func (cfg *AppConfigType) SyncProjectors() istructs.Projectors
type AppConfigsType ¶
type AppConfigsType map[istructs.AppQName]*AppConfigType
AppConfigsType: map of applications configurators
func (*AppConfigsType) AddConfig ¶
func (cfgs *AppConfigsType) AddConfig(appName istructs.AppQName, appDef appdef.IAppDefBuilder) *AppConfigType
AddConfig: adds new config for specified application or replaces if exists
func (*AppConfigsType) GetConfig ¶
func (cfgs *AppConfigsType) GetConfig(appName istructs.AppQName) *AppConfigType
GetConfig: gets config for specified application
type ExecCommandClosure ¶
type ExecCommandClosure func(args istructs.ExecCommandArgs) (err error)
Function type to call for command execute action
type ExecQueryClosure ¶
type ExecQueryClosure func(ctx context.Context, args istructs.ExecQueryArgs, callback istructs.ExecQueryCallback) (err error)
Function type to call for query execute action
type Resources ¶
type Resources struct {
// contains filtered or unexported fields
}
Implements istructs.IResources
func (*Resources) QueryResource ¶
Finds application resource by QName
type ValidateError ¶
ValidateError: an interface for describing errors that occurred during validation
- methods: — Code(): returns error code, see ECode_××× constants
Source Files ¶
- appstruct-types.go
- constraints.go
- consts.go
- errors.go
- event-dynobuf.go
- event-types.go
- idgenerator.go
- impl.go
- log_iterate.go
- provide.go
- ratelimits-types.go
- resources-types.go
- tables-types.go
- types-dynobuf.go
- types.go
- utils.go
- validation-errors.go
- validation.go
- viewrecords-dynobuf.go
- viewrecords-types.go