refactor(project): 🗑️ cleanup

master
Xeronith 2022-11-01 16:12:40 +03:30
rodzic b2c947078a
commit 86069315cd
22 zmienionych plików z 0 dodań i 1178 usunięć

Wyświetl plik

@ -45,18 +45,6 @@ func TestEchoApi(test *testing.T) {
}
}
func TestResolveErrorApi(test *testing.T) {
input := &ResolveErrorRequest{
Document: nil,
}
if output, err := api.ResolveError(input); err != nil {
test.Fatal(err)
} else if output == nil {
test.Fail()
}
}
//region Initialization
func TestMain(main *testing.M) {

Wyświetl plik

@ -8,7 +8,6 @@ func (factory *operationFactory) Operations() []IOperation {
return []IOperation{
SystemCallOperation(),
EchoOperation(),
ResolveErrorOperation(),
}
}

Wyświetl plik

@ -1,51 +0,0 @@
package operations
import (
. "github.com/xeronith/diamante/contracts/operation"
. "github.com/xeronith/diamante/contracts/service"
. "github.com/xeronith/diamante/contracts/system"
. "github.com/xeronith/diamante/operation"
. "rail.town/infrastructure/components/api/protobuf"
. "rail.town/infrastructure/components/api/services"
. "rail.town/infrastructure/components/contracts"
)
type resolveErrorOperation struct {
SecureOperation
run func(IContext, *ResolveErrorRequest) (*ResolveErrorResult, error)
}
func ResolveErrorOperation() IOperation {
return &resolveErrorOperation{
run: ResolveErrorService,
}
}
func (operation *resolveErrorOperation) Id() (ID, ID) {
return RESOLVE_ERROR_REQUEST, RESOLVE_ERROR_RESULT
}
func (operation *resolveErrorOperation) InputContainer() Pointer {
return new(ResolveErrorRequest)
}
func (operation *resolveErrorOperation) OutputContainer() Pointer {
return new(ResolveErrorResult)
}
func (operation *resolveErrorOperation) Execute(context IContext, payload Pointer) (Pointer, error) {
return operation.run(context, payload.(*ResolveErrorRequest))
}
/*
func (operation *resolveErrorOperation) ExecutionTimeLimits() (Duration, Duration, Duration) {
var (
TIME_LIMIT_WARNING Duration = 20_000_000
TIME_LIMIT_ALERT Duration = 35_000_000
TIME_LIMIT_CRITICAL Duration = 50_000_000
)
return TIME_LIMIT_WARNING, TIME_LIMIT_ALERT, TIME_LIMIT_CRITICAL
}
*/

Wyświetl plik

@ -1,204 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc v3.11.2
// source: custom_errors.proto
package __
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// API: ResolveError
// Operation: RESOLVE_ERROR_REQUEST 0x18B1805B
// ResultType: RESOLVE_ERROR_RESULT 0xEC02BAC4
// ------------------------------------------------------------------------------
type ResolveErrorRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Document *Document `protobuf:"bytes,1,opt,name=document,proto3" json:"document,omitempty"`
}
func (x *ResolveErrorRequest) Reset() {
*x = ResolveErrorRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_custom_errors_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ResolveErrorRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ResolveErrorRequest) ProtoMessage() {}
func (x *ResolveErrorRequest) ProtoReflect() protoreflect.Message {
mi := &file_custom_errors_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ResolveErrorRequest.ProtoReflect.Descriptor instead.
func (*ResolveErrorRequest) Descriptor() ([]byte, []int) {
return file_custom_errors_proto_rawDescGZIP(), []int{0}
}
func (x *ResolveErrorRequest) GetDocument() *Document {
if x != nil {
return x.Document
}
return nil
}
type ResolveErrorResult struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *ResolveErrorResult) Reset() {
*x = ResolveErrorResult{}
if protoimpl.UnsafeEnabled {
mi := &file_custom_errors_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ResolveErrorResult) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ResolveErrorResult) ProtoMessage() {}
func (x *ResolveErrorResult) ProtoReflect() protoreflect.Message {
mi := &file_custom_errors_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ResolveErrorResult.ProtoReflect.Descriptor instead.
func (*ResolveErrorResult) Descriptor() ([]byte, []int) {
return file_custom_errors_proto_rawDescGZIP(), []int{1}
}
var File_custom_errors_proto protoreflect.FileDescriptor
var file_custom_errors_proto_rawDesc = []byte{
0x0a, 0x13, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x1a,
0x0d, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x45,
0x0a, 0x13, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x08, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e,
0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
0x75, 0x66, 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x64, 0x6f, 0x63,
0x75, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x14, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65,
0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x04, 0x5a, 0x02, 0x2e,
0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_custom_errors_proto_rawDescOnce sync.Once
file_custom_errors_proto_rawDescData = file_custom_errors_proto_rawDesc
)
func file_custom_errors_proto_rawDescGZIP() []byte {
file_custom_errors_proto_rawDescOnce.Do(func() {
file_custom_errors_proto_rawDescData = protoimpl.X.CompressGZIP(file_custom_errors_proto_rawDescData)
})
return file_custom_errors_proto_rawDescData
}
var file_custom_errors_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_custom_errors_proto_goTypes = []interface{}{
(*ResolveErrorRequest)(nil), // 0: protobuf.ResolveErrorRequest
(*ResolveErrorResult)(nil), // 1: protobuf.ResolveErrorResult
(*Document)(nil), // 2: protobuf.Document
}
var file_custom_errors_proto_depIdxs = []int32{
2, // 0: protobuf.ResolveErrorRequest.document:type_name -> protobuf.Document
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_custom_errors_proto_init() }
func file_custom_errors_proto_init() {
if File_custom_errors_proto != nil {
return
}
file_objects_proto_init()
if !protoimpl.UnsafeEnabled {
file_custom_errors_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ResolveErrorRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_custom_errors_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ResolveErrorResult); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_custom_errors_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_custom_errors_proto_goTypes,
DependencyIndexes: file_custom_errors_proto_depIdxs,
MessageInfos: file_custom_errors_proto_msgTypes,
}.Build()
File_custom_errors_proto = out.File
file_custom_errors_proto_rawDesc = nil
file_custom_errors_proto_goTypes = nil
file_custom_errors_proto_depIdxs = nil
}

Wyświetl plik

@ -1,20 +0,0 @@
syntax = "proto3";
package protobuf;
option go_package = "./";
import "objects.proto";
// API: ResolveError
// Operation: RESOLVE_ERROR_REQUEST 0x18B1805B
// ResultType: RESOLVE_ERROR_RESULT 0xEC02BAC4
//------------------------------------------------------------------------------
message ResolveErrorRequest {
Document document = 0x00000001;
}
message ResolveErrorResult {
}
//------------------------------------------------------------------------------

Wyświetl plik

@ -1,37 +0,0 @@
package services
import (
. "github.com/xeronith/diamante/contracts/service"
. "rail.town/infrastructure/components/api/protobuf"
. "rail.town/infrastructure/components/contracts"
"rail.town/infrastructure/components/core"
)
// noinspection GoUnusedParameter
func ResolveErrorService(context IContext, input *ResolveErrorRequest) (result *ResolveErrorResult, err error) {
conductor := core.Conductor
_ = RESOLVE_ERROR_REQUEST
conductor.LogRemoteCall(context, INITIALIZE, "resolve_error", input, result, err)
defer func() { conductor.LogRemoteCall(context, FINALIZE, "resolve_error", input, result, err) }()
var inputDocument IDocument
if input.Document != nil {
var err error
if inputDocument, err = conductor.NewDocument(input.Document.Id, input.Document.Content); err == nil {
} else {
return nil, err
}
}
_result, _err := conductor.ResolveError(inputDocument, context.Identity())
if _err != nil {
err = _err
return nil, err
}
_ = _result
result = context.ResultContainer().(*ResolveErrorResult)
return result, nil
}

Wyświetl plik

@ -24,7 +24,6 @@ const (
ERROR_MESSAGE_USER_NOT_FOUND = "ERROR_MESSAGE_USER_NOT_FOUND"
ERROR_MESSAGE_ACTIVITY_PUB_OBJECT_NOT_FOUND = "ERROR_MESSAGE_ACTIVITY_PUB_OBJECT_NOT_FOUND"
ERROR_MESSAGE_SPI_NOT_FOUND = "ERROR_MESSAGE_SPI_NOT_FOUND"
ERROR_MESSAGE_CUSTOM_ERROR_NOT_FOUND = "ERROR_MESSAGE_CUSTOM_ERROR_NOT_FOUND"
ERROR_MESSAGE_UNKNOWN_DOCUMENT = "ERROR_MESSAGE_UNKNOWN_DOCUMENT"
ERROR_MESSAGE_UNKNOWN_SYSTEM_SCHEDULE = "ERROR_MESSAGE_UNKNOWN_SYSTEM_SCHEDULE"
ERROR_MESSAGE_UNKNOWN_IDENTITY = "ERROR_MESSAGE_UNKNOWN_IDENTITY"
@ -35,7 +34,6 @@ const (
ERROR_MESSAGE_UNKNOWN_USER = "ERROR_MESSAGE_UNKNOWN_USER"
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_OBJECT = "ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_OBJECT"
ERROR_MESSAGE_UNKNOWN_SPI = "ERROR_MESSAGE_UNKNOWN_SPI"
ERROR_MESSAGE_UNKNOWN_CUSTOM_ERROR = "ERROR_MESSAGE_UNKNOWN_CUSTOM_ERROR"
ERROR_MESSAGE_INVALID_ID = "ERROR_MESSAGE_INVALID_ID"
ERROR_MESSAGE_INVALID_PARAMETERS = "ERROR_MESSAGE_INVALID_PARAMETERS"
// CUSTOM_ERRORS
@ -71,7 +69,6 @@ var (
ERROR_USER_NOT_FOUND = errors.New(ERROR_MESSAGE_USER_NOT_FOUND)
ERROR_ACTIVITY_PUB_OBJECT_NOT_FOUND = errors.New(ERROR_MESSAGE_ACTIVITY_PUB_OBJECT_NOT_FOUND)
ERROR_SPI_NOT_FOUND = errors.New(ERROR_MESSAGE_SPI_NOT_FOUND)
ERROR_CUSTOM_ERROR_NOT_FOUND = errors.New(ERROR_MESSAGE_CUSTOM_ERROR_NOT_FOUND)
ERROR_UNKNOWN_DOCUMENT = errors.New(ERROR_MESSAGE_UNKNOWN_DOCUMENT)
ERROR_UNKNOWN_SYSTEM_SCHEDULE = errors.New(ERROR_MESSAGE_UNKNOWN_SYSTEM_SCHEDULE)
ERROR_UNKNOWN_IDENTITY = errors.New(ERROR_MESSAGE_UNKNOWN_IDENTITY)
@ -82,7 +79,6 @@ var (
ERROR_UNKNOWN_USER = errors.New(ERROR_MESSAGE_UNKNOWN_USER)
ERROR_UNKNOWN_ACTIVITY_PUB_OBJECT = errors.New(ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_OBJECT)
ERROR_UNKNOWN_SPI = errors.New(ERROR_MESSAGE_UNKNOWN_SPI)
ERROR_UNKNOWN_CUSTOM_ERROR = errors.New(ERROR_MESSAGE_UNKNOWN_CUSTOM_ERROR)
ERROR_INVALID_ID = errors.New(ERROR_MESSAGE_INVALID_ID)
ERROR_INVALID_PARAMETERS = errors.New(ERROR_MESSAGE_INVALID_PARAMETERS)
// CUSTOM_ERRORS

Wyświetl plik

@ -21,7 +21,6 @@ var Errors = Resource{
ERROR_MESSAGE_USER_NOT_FOUND: "user_not_found",
ERROR_MESSAGE_ACTIVITY_PUB_OBJECT_NOT_FOUND: "activity_pub_object_not_found",
ERROR_MESSAGE_SPI_NOT_FOUND: "spi_not_found",
ERROR_MESSAGE_CUSTOM_ERROR_NOT_FOUND: "custom_error_not_found",
ERROR_MESSAGE_UNKNOWN_DOCUMENT: "unknown_document",
ERROR_MESSAGE_UNKNOWN_SYSTEM_SCHEDULE: "unknown_system_schedule",
ERROR_MESSAGE_UNKNOWN_IDENTITY: "unknown_identity",
@ -32,7 +31,6 @@ var Errors = Resource{
ERROR_MESSAGE_UNKNOWN_USER: "unknown_user",
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_OBJECT: "unknown_activity_pub_object",
ERROR_MESSAGE_UNKNOWN_SPI: "unknown_spi",
ERROR_MESSAGE_UNKNOWN_CUSTOM_ERROR: "unknown_custom_error",
ERROR_MESSAGE_INVALID_ID: "invalid_id",
ERROR_MESSAGE_INVALID_PARAMETERS: "invalid_parameters",
// CUSTOM_ERRORS

Wyświetl plik

@ -8,5 +8,4 @@ type IApi interface {
//API Methods
SystemCall(*SystemCallRequest) (*SystemCallResult, error)
Echo(*EchoRequest) (*EchoResult, error)
ResolveError(*ResolveErrorRequest) (*ResolveErrorResult, error)
}

Wyświetl plik

@ -1,62 +0,0 @@
package contracts
import . "github.com/xeronith/diamante/contracts/security"
var CustomErrorPassThroughFilter = func(ICustomError) bool { return true }
type (
CustomErrors []ICustomError
CustomErrorIterator func(ICustomError)
CustomErrorCondition func(ICustomError) bool
CustomErrorFilterPredicate func(ICustomError) bool
CustomErrorMapPredicate func(ICustomError) ICustomError
CustomErrorCacheCallback func()
ICustomError interface {
}
ICustomErrorCollection interface {
Count() int
IsEmpty() bool
IsNotEmpty() bool
HasExactlyOneItem() bool
HasAtLeastOneItem() bool
First() ICustomError
Append(customError ICustomError)
ForEach(CustomErrorIterator)
Array() CustomErrors
}
ICustomErrorManager interface {
ISystemComponent
OnCacheChanged(CustomErrorCacheCallback)
Count() int
Exists(id int64) bool
ExistsWhich(condition CustomErrorCondition) bool
ListCustomErrors(pageIndex uint32, pageSize uint32, criteria string, editor Identity) ICustomErrorCollection
GetCustomError(id int64, editor Identity) (ICustomError, error)
AddCustomError(editor Identity) (ICustomError, error)
AddCustomErrorWithCustomId(id int64, editor Identity) (ICustomError, error)
AddCustomErrorObject(customError ICustomError, editor Identity) (ICustomError, error)
AddCustomErrorAtomic(transaction ITransaction, editor Identity) (ICustomError, error)
AddCustomErrorWithCustomIdAtomic(id int64, transaction ITransaction, editor Identity) (ICustomError, error)
AddCustomErrorObjectAtomic(transaction ITransaction, customError ICustomError, editor Identity) (ICustomError, error)
Log(source string, editor Identity, payload string)
UpdateCustomError(id int64, editor Identity) (ICustomError, error)
UpdateCustomErrorObject(id int64, customError ICustomError, editor Identity) (ICustomError, error)
UpdateCustomErrorAtomic(transaction ITransaction, id int64, editor Identity) (ICustomError, error)
UpdateCustomErrorObjectAtomic(transaction ITransaction, id int64, customError ICustomError, editor Identity) (ICustomError, error)
AddOrUpdateCustomErrorObject(id int64, customError ICustomError, editor Identity) (ICustomError, error)
AddOrUpdateCustomErrorObjectAtomic(transaction ITransaction, id int64, customError ICustomError, editor Identity) (ICustomError, error)
RemoveCustomError(id int64, editor Identity) (ICustomError, error)
RemoveCustomErrorAtomic(transaction ITransaction, id int64, editor Identity) (ICustomError, error)
Find(id int64) ICustomError
ForEach(iterator CustomErrorIterator)
Filter(predicate CustomErrorFilterPredicate) ICustomErrorCollection
Map(predicate CustomErrorMapPredicate) ICustomErrorCollection
ResolveError(document IDocument, editor Identity) (IResolveErrorResult, error)
}
IResolveErrorResult interface {
}
)

Wyświetl plik

@ -11,16 +11,10 @@ const (
//EchoOperation
ECHO_REQUEST = 0x0541BD72
ECHO_RESULT = 0xAB2FF7D4
//ResolveErrorOperation
RESOLVE_ERROR_REQUEST = 0x18B1805B
RESOLVE_ERROR_RESULT = 0xEC02BAC4
)
var OPCODES = Opcodes{
0x00000000: "N/A",
0x0541BD72: "ECHO",
0xAB2FF7D4: "Echo",
0x18B1805B: "RESOLVE_ERROR",
0xEC02BAC4: "ResolveError",
}

Wyświetl plik

@ -164,20 +164,6 @@ type (
RemoveSpiAtomic(transaction ITransaction, id int64, editor Identity) (ISpi, error)
Echo(document IDocument, editor Identity) (IEchoResult, error)
// CustomError
CustomErrorManager() ICustomErrorManager
CustomErrorExists(id int64) bool
ListCustomErrors(pageIndex uint32, pageSize uint32, criteria string, editor Identity) ICustomErrorCollection
GetCustomError(id int64, editor Identity) (ICustomError, error)
AddCustomError(editor Identity) (ICustomError, error)
AddCustomErrorAtomic(transaction ITransaction, editor Identity) (ICustomError, error)
LogCustomError(source string, editor Identity, payload string)
UpdateCustomError(id int64, editor Identity) (ICustomError, error)
UpdateCustomErrorAtomic(transaction ITransaction, id int64, editor Identity) (ICustomError, error)
RemoveCustomError(id int64, editor Identity) (ICustomError, error)
RemoveCustomErrorAtomic(transaction ITransaction, id int64, editor Identity) (ICustomError, error)
ResolveError(document IDocument, editor Identity) (IResolveErrorResult, error)
NewDocument(id int64, content string) (IDocument, error)
NewSystemSchedule(id int64, enabled bool, config string) (ISystemSchedule, error)
NewIdentity(id int64, username string, phoneNumber string, phoneNumberConfirmed bool, firstName string, lastName string, displayName string, email string, emailConfirmed bool, avatar string, banner string, summary string, token string, multiFactor bool, hash string, salt string, publicKey string, privateKey string, permission uint64, restriction uint32, lastLogin int64, loginCount uint32) (IIdentity, error)
@ -188,9 +174,7 @@ type (
NewUser(id int64, github string) (IUser, error)
NewActivityPubObject() (IActivityPubObject, error)
NewSpi() (ISpi, error)
NewCustomError() (ICustomError, error)
NewEchoResult(document IDocument, ignored interface{}) IEchoResult
NewResolveErrorResult(ignored interface{}) IResolveErrorResult
}
ISystemComponent interface {
@ -245,5 +229,4 @@ const (
SYSTEM_COMPONENT_USER_MANAGER SystemComponentType = 0x00000008
SYSTEM_COMPONENT_ACTIVITY_PUB_OBJECT_MANAGER SystemComponentType = 0x00000009
SYSTEM_COMPONENT_SPI_MANAGER SystemComponentType = 0x0000000A
SYSTEM_COMPONENT_CUSTOM_ERROR_MANAGER SystemComponentType = 0x0000000B
)

Wyświetl plik

@ -615,63 +615,6 @@ type IDispatcher interface {
RemoveSpi(id int64) ISpi
Echo(document IDocument) (IEchoResult, error)
// CustomError
// ------------------------------------------------------------
// CustomErrorExists checks whether a specific 'Custom Error' with the provided
// unique identifier or 'Id' exists in the system.
CustomErrorExists(id int64) bool
// CustomErrorExistsWhich checks whether a specific 'Custom Error' exists in the system
// which satisfies the provided condition.
CustomErrorExistsWhich(condition CustomErrorCondition) bool
// ListCustomErrors returns a list of all 'Custom Error' instances in the system.
ListCustomErrors() ICustomErrorCollection
// ForEachCustomError loops over all 'Custom Error' instances in the system running
// the provided iterator for each of them.
ForEachCustomError(iterator CustomErrorIterator)
// FilterCustomErrors returns a filtered list of 'Custom Error' instances based
// on the provided predicate.
FilterCustomErrors(predicate CustomErrorFilterPredicate) ICustomErrorCollection
// MapCustomErrors loops over all 'Custom Error' instances in the system and
// returns a transformed list based on the provided predicate.
MapCustomErrors(predicate CustomErrorMapPredicate) ICustomErrorCollection
// GetCustomError finds a specific 'Custom Error' instance using
// the provided unique identifier or 'Id'.
GetCustomError(id int64) ICustomError
// AddCustomError creates a new 'Custom Error' instance with an auto-generated unique identifier using the
// provided property values and adds it to persistent data store and system cache.
// The method is smart enough to respect the transaction if used in an
// x.Atomic context. This method is synchronous.
AddCustomError() ICustomError
// AddCustomErrorWithCustomId creates a new 'Custom Error' instance with a custom unique identifier using the
// provided property values and adds it to persistent data store and system cache.
// The method is smart enough to respect the transaction if used in an
// x.Atomic context. This method is synchronous.
AddCustomErrorWithCustomId(id int64) ICustomError
// LogCustomError creates a new 'Custom Error' instance using the provided property values
// and adds it to persistent data store and system cache.
// The method is smart enough to respect the transaction if used in an
// x.Atomic context. This method is asynchronous.
LogCustomError(source string, payload string)
// UpdateCustomError finds the 'Custom Error' instance using the provided unique identifier and updates it using
// the provided property values and reflects the changes to persistent data store and system
// cache. The method is smart enough to respect the transaction if used in an x.Atomic context.
// This method is synchronous.
UpdateCustomError(id int64) ICustomError
// UpdateCustomErrorObject finds and updates the 'Custom Error' using the provided instance and reflects the
// changes to persistent data store and system cache. The method is smart enough to
// respect the transaction if used in an x.Atomic context. This method is synchronous.
UpdateCustomErrorObject(object IObject, customError ICustomError) ICustomError
// AddOrUpdateCustomErrorObject tries to find the 'Custom Error' using the provided instance, then updates it in persistent
// data store and system cache or creates it if doesn't already exist. The method is smart enough
// to respect the transaction if used in an x.Atomic context. This method is synchronous.
AddOrUpdateCustomErrorObject(object IObject, customError ICustomError) ICustomError
// RemoveCustomError finds the 'Custom Error' instance using the provided unique identifier and
// removes it from the system cache. The method is smart enough to respect
// the transaction if used in an x.Atomic context. This method is synchronous.
RemoveCustomError(id int64) ICustomError
ResolveError(document IDocument) (IResolveErrorResult, error)
// NewDocument creates a new 'Document' instance using the provided property values.
NewDocument(id int64, content string) (IDocument, error)
// NewDocuments creates an empty in-memory 'Document' collection which is not thread-safe.
@ -712,14 +655,8 @@ type IDispatcher interface {
NewSpi() (ISpi, error)
// NewSpis creates an empty in-memory 'Spi' collection which is not thread-safe.
NewSpis() ISpiCollection
// NewCustomError creates a new 'Custom Error' instance using the provided property values.
NewCustomError() (ICustomError, error)
// NewCustomErrors creates an empty in-memory 'Custom Error' collection which is not thread-safe.
NewCustomErrors() ICustomErrorCollection
// NewEchoResult creates a new result container for 'Echo' system action.
NewEchoResult(document IDocument) IEchoResult
// NewResolveErrorResult creates a new result container for 'Resolve Error' system action.
NewResolveErrorResult() IResolveErrorResult
// Assert asserts the provided condition and panics if the assertion is not valid.
Assert(condition bool) IAssertionResult
// AssertNoError panics if the provided error is not nil.

Wyświetl plik

@ -25,18 +25,7 @@ func (api *api) Echo(request *EchoRequest) (*EchoResult, error) {
}
}
func (api *api) ResolveError(request *ResolveErrorRequest) (*ResolveErrorResult, error) {
result, err := api.call(RESOLVE_ERROR_REQUEST, request)
if err != nil {
return nil, err
} else {
return result.(*ResolveErrorResult), nil
}
}
func init() {
API_RESULT[SYSTEM_CALL_RESULT] = SystemCallResult{}
API_RESULT[ECHO_RESULT] = EchoResult{}
API_RESULT[RESOLVE_ERROR_RESULT] = ResolveErrorResult{}
}

Wyświetl plik

@ -44,8 +44,4 @@ func (dispatcher *dispatcher) NewSpis() ISpiCollection {
return NewSpis()
}
func (dispatcher *dispatcher) NewCustomErrors() ICustomErrorCollection {
return NewCustomErrors()
}
//endregion

Wyświetl plik

@ -1,240 +0,0 @@
package core
import (
"fmt"
. "github.com/xeronith/diamante/contracts/security"
"rail.town/infrastructure/app/validators"
. "rail.town/infrastructure/components/constants"
. "rail.town/infrastructure/components/contracts"
"rail.town/infrastructure/components/model/repository"
)
type customError struct {
}
// noinspection GoUnusedExportedFunction
func InitializeCustomError() {
_ = ENABLE_SECURITY
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
_ = repository.Initialize
}
func NewCustomError() (ICustomError, error) {
instance := &customError{}
if err := instance.Validate(); err != nil {
return nil, err
}
return instance, nil
}
func (customError *customError) Validate() error {
return nil
}
func (customError *customError) String() string {
return fmt.Sprintf("CustomError (Id: %d)", 0)
}
//------------------------------------------------------------------------------
type customErrors struct {
collection CustomErrors
}
// NewCustomErrors creates an empty collection of 'Custom Error' which is not thread-safe.
func NewCustomErrors() ICustomErrorCollection {
return &customErrors{
collection: make(CustomErrors, 0),
}
}
func (customErrors *customErrors) Count() int {
return len(customErrors.collection)
}
func (customErrors *customErrors) IsEmpty() bool {
return len(customErrors.collection) == 0
}
func (customErrors *customErrors) IsNotEmpty() bool {
return len(customErrors.collection) > 0
}
func (customErrors *customErrors) HasExactlyOneItem() bool {
return len(customErrors.collection) == 1
}
func (customErrors *customErrors) HasAtLeastOneItem() bool {
return len(customErrors.collection) >= 1
}
func (customErrors *customErrors) First() ICustomError {
return customErrors.collection[0]
}
func (customErrors *customErrors) Append(customError ICustomError) {
customErrors.collection = append(customErrors.collection, customError)
}
func (customErrors *customErrors) ForEach(iterator CustomErrorIterator) {
if iterator == nil {
return
}
for _, value := range customErrors.collection {
iterator(value)
}
}
func (customErrors *customErrors) Array() CustomErrors {
return customErrors.collection
}
//------------------------------------------------------------------------------
func (dispatcher *dispatcher) CustomErrorExists(id int64) bool {
return dispatcher.conductor.CustomErrorManager().Exists(id)
}
func (dispatcher *dispatcher) CustomErrorExistsWhich(condition CustomErrorCondition) bool {
return dispatcher.conductor.CustomErrorManager().ExistsWhich(condition)
}
func (dispatcher *dispatcher) ListCustomErrors() ICustomErrorCollection {
return dispatcher.conductor.CustomErrorManager().ListCustomErrors(0, 0, "", dispatcher.identity)
}
func (dispatcher *dispatcher) ForEachCustomError(iterator CustomErrorIterator) {
dispatcher.conductor.CustomErrorManager().ForEach(iterator)
}
func (dispatcher *dispatcher) FilterCustomErrors(predicate CustomErrorFilterPredicate) ICustomErrorCollection {
return dispatcher.conductor.CustomErrorManager().Filter(predicate)
}
func (dispatcher *dispatcher) MapCustomErrors(predicate CustomErrorMapPredicate) ICustomErrorCollection {
return dispatcher.conductor.CustomErrorManager().Map(predicate)
}
func (dispatcher *dispatcher) GetCustomError(id int64) ICustomError {
if customError, err := dispatcher.conductor.CustomErrorManager().GetCustomError(id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return customError
}
}
func (dispatcher *dispatcher) AddCustomError() ICustomError {
transaction := dispatcher.transaction
if transaction != nil {
if customError, err := dispatcher.conductor.CustomErrorManager().AddCustomErrorAtomic(transaction, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return customError
}
} else {
if customError, err := dispatcher.conductor.CustomErrorManager().AddCustomError(dispatcher.identity); err != nil {
panic(err.Error())
} else {
return customError
}
}
}
func (dispatcher *dispatcher) AddCustomErrorWithCustomId(id int64) ICustomError {
transaction := dispatcher.transaction
if transaction != nil {
if customError, err := dispatcher.conductor.CustomErrorManager().AddCustomErrorWithCustomIdAtomic(id, transaction, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return customError
}
} else {
if customError, err := dispatcher.conductor.CustomErrorManager().AddCustomErrorWithCustomId(id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return customError
}
}
}
func (dispatcher *dispatcher) LogCustomError(source string, payload string) {
dispatcher.conductor.CustomErrorManager().Log(source, dispatcher.identity, payload)
}
func (dispatcher *dispatcher) UpdateCustomError(id int64) ICustomError {
transaction := dispatcher.transaction
if transaction != nil {
if customError, err := dispatcher.conductor.CustomErrorManager().UpdateCustomErrorAtomic(transaction, id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return customError
}
} else {
if customError, err := dispatcher.conductor.CustomErrorManager().UpdateCustomError(id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return customError
}
}
}
// noinspection GoUnusedParameter
func (dispatcher *dispatcher) UpdateCustomErrorObject(object IObject, customError ICustomError) ICustomError {
transaction := dispatcher.transaction
if transaction != nil {
if customError, err := dispatcher.conductor.CustomErrorManager().UpdateCustomErrorAtomic(transaction, object.Id(), dispatcher.identity); err != nil {
panic(err.Error())
} else {
return customError
}
} else {
if customError, err := dispatcher.conductor.CustomErrorManager().UpdateCustomError(object.Id(), dispatcher.identity); err != nil {
panic(err.Error())
} else {
return customError
}
}
}
func (dispatcher *dispatcher) AddOrUpdateCustomErrorObject(object IObject, customError ICustomError) ICustomError {
transaction := dispatcher.transaction
if transaction != nil {
if customError, err := dispatcher.conductor.CustomErrorManager().AddOrUpdateCustomErrorObjectAtomic(transaction, object.Id(), customError, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return customError
}
} else {
if customError, err := dispatcher.conductor.CustomErrorManager().AddOrUpdateCustomErrorObject(object.Id(), customError, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return customError
}
}
}
func (dispatcher *dispatcher) RemoveCustomError(id int64) ICustomError {
transaction := dispatcher.transaction
if transaction != nil {
if customError, err := dispatcher.conductor.CustomErrorManager().RemoveCustomErrorAtomic(transaction, id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return customError
}
} else {
if customError, err := dispatcher.conductor.CustomErrorManager().RemoveCustomError(id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return customError
}
}
}
func (dispatcher *dispatcher) ResolveError(document IDocument) (IResolveErrorResult, error) {
return dispatcher.conductor.CustomErrorManager().ResolveError(document, dispatcher.identity)
}

Wyświetl plik

@ -1,211 +0,0 @@
package core
import (
. "github.com/xeronith/diamante/contracts/logging"
. "github.com/xeronith/diamante/contracts/security"
. "github.com/xeronith/diamante/contracts/settings"
. "github.com/xeronith/diamante/contracts/system"
. "github.com/xeronith/diamante/system"
"rail.town/infrastructure/app/validators"
. "rail.town/infrastructure/components/constants"
. "rail.town/infrastructure/components/contracts"
)
// noinspection GoSnakeCaseUsage
const CUSTOM_ERROR_MANAGER = "CustomErrorManager"
type customErrorManager struct {
systemComponent
cache ICache
}
func newCustomErrorManager(configuration IConfiguration, logger ILogger, dependencies ...ISystemComponent) ICustomErrorManager {
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
manager := &customErrorManager{
systemComponent: newSystemComponent(configuration, logger),
cache: NewCache(),
}
if err := manager.ResolveDependencies(dependencies...); err != nil {
return nil
}
return manager
}
func (manager *customErrorManager) Name() string {
return CUSTOM_ERROR_MANAGER
}
func (manager *customErrorManager) ResolveDependencies(_ ...ISystemComponent) error {
return nil
}
func (manager *customErrorManager) Load() error {
return nil
}
func (manager *customErrorManager) Reload() error {
return manager.Load()
}
func (manager *customErrorManager) OnCacheChanged(callback CustomErrorCacheCallback) {
manager.cache.OnChanged(callback)
}
func (manager *customErrorManager) Count() int {
return manager.cache.Size()
}
func (manager *customErrorManager) Exists(id int64) bool {
return manager.Find(id) != nil
}
func (manager *customErrorManager) ExistsWhich(condition CustomErrorCondition) bool {
var customErrors CustomErrors
manager.ForEach(func(customError ICustomError) {
if condition(customError) {
customErrors = append(customErrors, customError)
}
})
return len(customErrors) > 0
}
func (manager *customErrorManager) ListCustomErrors(_ /* pageIndex */ uint32, _ /* pageSize */ uint32, _ /* criteria */ string, _ Identity) ICustomErrorCollection {
return manager.Filter(CustomErrorPassThroughFilter)
}
func (manager *customErrorManager) GetCustomError(id int64, _ Identity) (ICustomError, error) {
if customError := manager.Find(id); customError == nil {
return nil, ERROR_CUSTOM_ERROR_NOT_FOUND
} else {
return customError, nil
}
}
func (manager *customErrorManager) AddCustomError(editor Identity) (ICustomError, error) {
return nil, ERROR_NOT_IMPLEMENTED
}
func (manager *customErrorManager) AddCustomErrorWithCustomId(id int64, editor Identity) (ICustomError, error) {
return nil, ERROR_NOT_IMPLEMENTED
}
func (manager *customErrorManager) AddCustomErrorObject(customError ICustomError, editor Identity) (ICustomError, error) {
return nil, ERROR_NOT_IMPLEMENTED
}
func (manager *customErrorManager) AddCustomErrorAtomic(transaction ITransaction, editor Identity) (ICustomError, error) {
return nil, ERROR_NOT_IMPLEMENTED
}
func (manager *customErrorManager) AddCustomErrorWithCustomIdAtomic(id int64, transaction ITransaction, editor Identity) (ICustomError, error) {
return nil, ERROR_NOT_IMPLEMENTED
}
func (manager *customErrorManager) AddCustomErrorObjectAtomic(transaction ITransaction, customError ICustomError, editor Identity) (ICustomError, error) {
return nil, ERROR_NOT_IMPLEMENTED
}
func (manager *customErrorManager) Log(source string, editor Identity, payload string) {
}
func (manager *customErrorManager) UpdateCustomError(id int64, editor Identity) (ICustomError, error) {
return nil, ERROR_NOT_IMPLEMENTED
}
func (manager *customErrorManager) UpdateCustomErrorObject(id int64, customError ICustomError, editor Identity) (ICustomError, error) {
return nil, ERROR_NOT_IMPLEMENTED
}
func (manager *customErrorManager) UpdateCustomErrorAtomic(transaction ITransaction, id int64, editor Identity) (ICustomError, error) {
return nil, ERROR_NOT_IMPLEMENTED
}
func (manager *customErrorManager) UpdateCustomErrorObjectAtomic(transaction ITransaction, id int64, customError ICustomError, editor Identity) (ICustomError, error) {
return nil, ERROR_NOT_IMPLEMENTED
}
func (manager *customErrorManager) AddOrUpdateCustomErrorObject(id int64, customError ICustomError, editor Identity) (ICustomError, error) {
if manager.Exists(id) {
return manager.UpdateCustomErrorObject(id, customError, editor)
} else {
return manager.AddCustomErrorObject(customError, editor)
}
}
func (manager *customErrorManager) AddOrUpdateCustomErrorObjectAtomic(transaction ITransaction, id int64, customError ICustomError, editor Identity) (ICustomError, error) {
if manager.Exists(id) {
return manager.UpdateCustomErrorObjectAtomic(transaction, id, customError, editor)
} else {
return manager.AddCustomErrorObjectAtomic(transaction, customError, editor)
}
}
func (manager *customErrorManager) RemoveCustomError(id int64, editor Identity) (ICustomError, error) {
return nil, ERROR_NOT_IMPLEMENTED
}
func (manager *customErrorManager) RemoveCustomErrorAtomic(transaction ITransaction, id int64, editor Identity) (ICustomError, error) {
return nil, ERROR_NOT_IMPLEMENTED
}
func (manager *customErrorManager) Find(id int64) ICustomError {
if object, exists := manager.cache.Get(id); !exists {
return nil
} else {
return object.(ICustomError)
}
}
func (manager *customErrorManager) ForEach(iterator CustomErrorIterator) {
manager.cache.ForEachValue(func(object ISystemObject) {
iterator(object.(ICustomError))
})
}
func (manager *customErrorManager) Filter(predicate CustomErrorFilterPredicate) ICustomErrorCollection {
customErrors := NewCustomErrors()
if predicate == nil {
return customErrors
}
manager.ForEach(func(customError ICustomError) {
if predicate(customError) {
customErrors.Append(customError)
}
})
return customErrors
}
func (manager *customErrorManager) Map(predicate CustomErrorMapPredicate) ICustomErrorCollection {
customErrors := NewCustomErrors()
if predicate == nil {
return customErrors
}
manager.ForEach(func(customError ICustomError) {
customErrors.Append(predicate(customError))
})
return customErrors
}
//region IResolveErrorResult Implementation
type resolveErrorResult struct {
}
func NewResolveErrorResult(_ interface{}) IResolveErrorResult {
return &resolveErrorResult{}
}
//endregion
func (manager *customErrorManager) ResolveError(document IDocument, editor Identity) (result IResolveErrorResult, err error) {
return nil, ERROR_NOT_IMPLEMENTED
}

Wyświetl plik

@ -1,161 +0,0 @@
package core_test
import (
"testing"
. "rail.town/infrastructure/components/constants"
. "rail.town/infrastructure/components/contracts"
. "rail.town/infrastructure/components/core"
)
func TestCustomErrorManager_GetName(test *testing.T) {
manager := Conductor.CustomErrorManager()
if manager.Name() != CUSTOM_ERROR_MANAGER {
test.Fail()
}
}
func TestCustomErrorManager_ResolveDependencies(test *testing.T) {
manager := Conductor.CustomErrorManager()
if err := manager.ResolveDependencies(); err != nil {
test.Fatal(err)
}
}
func TestCustomErrorManager_Load(test *testing.T) {
manager := Conductor.CustomErrorManager()
if err := manager.Load(); err != nil {
test.Fatal(err)
}
}
func TestCustomErrorManager_Reload(test *testing.T) {
manager := Conductor.CustomErrorManager()
if err := manager.Reload(); err != nil && err != ERROR_OPERATION_NOT_SUPPORTED {
test.Fatal(err)
}
}
func TestCustomErrorManager_Count(test *testing.T) {
manager := Conductor.CustomErrorManager()
_ = manager.Count()
}
func TestCustomErrorManager_Exists(test *testing.T) {
manager := Conductor.CustomErrorManager()
if manager.Exists(0) {
test.FailNow()
}
}
func TestCustomErrorManager_ListCustomErrors(test *testing.T) {
manager := Conductor.CustomErrorManager()
_ = manager.ListCustomErrors(0, 0, "", nil)
}
func TestCustomErrorManager_GetCustomError(test *testing.T) {
manager := Conductor.CustomErrorManager()
if customError, err := manager.GetCustomError(0, nil); err == nil {
_ = customError
test.FailNow()
}
}
func TestCustomErrorManager_AddCustomError(test *testing.T) {
manager := Conductor.CustomErrorManager()
customError, err := manager.AddCustomError(nil)
if err != nil {
test.Fatal(err)
}
_ = customError
}
func TestCustomErrorManager_UpdateCustomError(test *testing.T) {
manager := Conductor.CustomErrorManager()
customError, err := manager.UpdateCustomError(0, nil)
if err != nil {
test.Fatal(err)
}
_ = customError
}
func TestCustomErrorManager_RemoveCustomError(test *testing.T) {
manager := Conductor.CustomErrorManager()
customError, err := manager.RemoveCustomError(0, nil)
if err != nil {
test.Fatal(err)
}
_ = customError
}
func TestCustomErrorManager_Find(test *testing.T) {
manager := Conductor.CustomErrorManager()
customError := manager.Find(0)
if customError == nil {
test.Fail()
}
_ = customError
}
func TestCustomErrorManager_ForEach(test *testing.T) {
manager := Conductor.CustomErrorManager()
manager.ForEach(func(customError ICustomError) {
_ = customError
})
}
func TestCustomErrorManager_Filter(test *testing.T) {
manager := Conductor.CustomErrorManager()
customErrors := manager.Filter(func(customError ICustomError) bool {
return false
})
if customErrors.IsNotEmpty() {
test.Fail()
}
_ = customErrors
}
func TestCustomErrorManager_Map(test *testing.T) {
manager := Conductor.CustomErrorManager()
customErrors := manager.Map(func(customError ICustomError) ICustomError {
return customError
})
if customErrors.Count() != manager.Count() {
test.Fail()
}
_ = customErrors
}
func TestCustomErrorManager_ResolveError(test *testing.T) {
manager := Conductor.CustomErrorManager()
result, err := manager.ResolveError(nil, nil)
if err != nil {
test.Fatal(err)
}
_ = result
}

Wyświetl plik

@ -34,8 +34,6 @@ func (factory *systemComponentFactory) Create(componentType SystemComponentType,
component = newActivityPubObjectManager(configuration, logger, dependencies...)
case SYSTEM_COMPONENT_SPI_MANAGER:
component = newSpiManager(configuration, logger, dependencies...)
case SYSTEM_COMPONENT_CUSTOM_ERROR_MANAGER:
component = newCustomErrorManager(configuration, logger, dependencies...)
}
if component != nil {

Wyświetl plik

@ -64,7 +64,6 @@ func Initialize(configuration IConfiguration, logger ILogger) error {
userManager := factory.Create(SYSTEM_COMPONENT_USER_MANAGER, configuration, logger).(IUserManager)
activityPubObjectManager := factory.Create(SYSTEM_COMPONENT_ACTIVITY_PUB_OBJECT_MANAGER, configuration, logger).(IActivityPubObjectManager)
spiManager := factory.Create(SYSTEM_COMPONENT_SPI_MANAGER, configuration, logger).(ISpiManager)
customErrorManager := factory.Create(SYSTEM_COMPONENT_CUSTOM_ERROR_MANAGER, configuration, logger).(ICustomErrorManager)
// Resolving Dependencies
// @formatter:off
@ -95,7 +94,6 @@ func Initialize(configuration IConfiguration, logger ILogger) error {
userManager: userManager,
activityPubObjectManager: activityPubObjectManager,
spiManager: spiManager,
customErrorManager: customErrorManager,
logger: logger,
configuration: configuration,
scheduler: scheduler,
@ -157,7 +155,6 @@ type conductor struct {
userManager IUserManager
activityPubObjectManager IActivityPubObjectManager
spiManager ISpiManager
customErrorManager ICustomErrorManager
logger ILogger
configuration IConfiguration
scheduler *schedule.Cron
@ -737,56 +734,6 @@ func (conductor *conductor) Echo(document IDocument, editor Identity) (IEchoResu
return conductor.spiManager.Echo(document, editor)
}
// CustomError
func (conductor *conductor) CustomErrorManager() ICustomErrorManager {
return conductor.customErrorManager
}
func (conductor *conductor) CustomErrorExists(id int64) bool {
return conductor.customErrorManager.Exists(id)
}
func (conductor *conductor) ListCustomErrors(pageIndex uint32, pageSize uint32, criteria string, editor Identity) ICustomErrorCollection {
return conductor.customErrorManager.ListCustomErrors(pageIndex, pageSize, criteria, editor)
}
func (conductor *conductor) GetCustomError(id int64, editor Identity) (ICustomError, error) {
return conductor.customErrorManager.GetCustomError(id, editor)
}
func (conductor *conductor) AddCustomError(editor Identity) (ICustomError, error) {
return conductor.customErrorManager.AddCustomError(editor)
}
func (conductor *conductor) AddCustomErrorAtomic(transaction ITransaction, editor Identity) (ICustomError, error) {
return conductor.customErrorManager.AddCustomErrorAtomic(transaction, editor)
}
func (conductor *conductor) LogCustomError(source string, editor Identity, payload string) {
conductor.customErrorManager.Log(source, editor, payload)
}
func (conductor *conductor) UpdateCustomError(id int64, editor Identity) (ICustomError, error) {
return conductor.customErrorManager.UpdateCustomError(id, editor)
}
func (conductor *conductor) UpdateCustomErrorAtomic(transaction ITransaction, id int64, editor Identity) (ICustomError, error) {
return conductor.customErrorManager.UpdateCustomErrorAtomic(transaction, id, editor)
}
func (conductor *conductor) RemoveCustomError(id int64, editor Identity) (ICustomError, error) {
return conductor.customErrorManager.RemoveCustomError(id, editor)
}
func (conductor *conductor) RemoveCustomErrorAtomic(transaction ITransaction, id int64, editor Identity) (ICustomError, error) {
return conductor.customErrorManager.RemoveCustomErrorAtomic(transaction, id, editor)
}
func (conductor *conductor) ResolveError(document IDocument, editor Identity) (IResolveErrorResult, error) {
return conductor.customErrorManager.ResolveError(document, editor)
}
func (conductor *conductor) NewDocument(id int64, content string) (IDocument, error) {
return NewDocument(id, content)
}
@ -827,18 +774,10 @@ func (conductor *conductor) NewSpi() (ISpi, error) {
return NewSpi()
}
func (conductor *conductor) NewCustomError() (ICustomError, error) {
return NewCustomError()
}
func (conductor *conductor) NewEchoResult(document IDocument, _ interface{}) IEchoResult {
return NewEchoResult(document, nil)
}
func (conductor *conductor) NewResolveErrorResult(_ interface{}) IResolveErrorResult {
return NewResolveErrorResult(nil)
}
func (conductor *conductor) LogRemoteCall(context IContext, eventType uint32, source string, input, result interface{}, err error) {
errorMessage := ""
if err != nil {

Wyświetl plik

@ -148,10 +148,6 @@ func (dispatcher *dispatcher) NewSpi() (ISpi, error) {
return NewSpi()
}
func (dispatcher *dispatcher) NewCustomError() (ICustomError, error) {
return NewCustomError()
}
func (dispatcher *dispatcher) Assert(condition bool) IAssertionResult {
return &assertionResult{
condition: condition,

Wyświetl plik

@ -8,8 +8,4 @@ func (dispatcher *dispatcher) NewEchoResult(document IDocument) IEchoResult {
return NewEchoResult(document, nil)
}
func (dispatcher *dispatcher) NewResolveErrorResult() IResolveErrorResult {
return NewResolveErrorResult(nil)
}
//endregion