journal

package
v0.0.0-...-7d3e243 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EndpointUnknown specifies initial unknown endpoint
	EndpointUnknown int32 = 0

	// NoPlane section
	NoPlane       int32 = 0
	NoPlaneCustom       = NoPlane + 2000

	// ControlPlane section
	ControlPlane       int32 = 0
	EndpointTasks            = ControlPlane + 100
	ControlPlaneCustom       = ControlPlane + 2000

	// DataPlane section
	DataPlane               int32 = 3000
	EndpointDataChunks            = DataPlane + 100
	EndpointUploadObject          = DataPlane + 200
	EndpointUploadObjects         = DataPlane + 300
	EndpointDownloadObject        = DataPlane + 400
	EndpointDownloadObjects       = DataPlane + 500
	DataPlaneCustom               = DataPlane + 2000

	// HealthPlane section
	HealthPlane           int32 = 6000
	EndpointMetrics             = HealthPlane + 100
	EndpointStatusObject        = HealthPlane + 200
	EndpointStatusObjects       = HealthPlane + 300
	HealthPlaneCustom           = HealthPlane + 2000

	// ReportsPlane section
	ReportsPlane       int32 = 9000
	EndpointReport           = ReportsPlane + 100
	EndpointReports          = ReportsPlane + 200
	ReportsPlaneCustom       = ReportsPlane + 2000
)
View Source
const (
	EntryTypeUnknown          int32 = 0
	EntryTypeRequestStart     int32 = 1
	EntryTypeSaveData         int32 = 100
	EntryTypeSaveDataError    int32 = 101
	EntryTypeProcessData      int32 = 200
	EntryTypeProcessDataError int32 = 201
	EntryTypeResult           int32 = 300
	EntryTypeSaveTask         int32 = 400
	EntryTypeSaveTaskError    int32 = 401
	EntryTypeProcessTask      int32 = 500
	EntryTypeProcessTaskError int32 = 501
	EntryTypeLookup           int32 = 600
	EntryTypeLookupError      int32 = 601
	EntryTypeRequestCompleted int32 = 10000
	EntryTypeRequestError     int32 = 10001
)
View Source
const (
	ObjectTypeUnknown int32 = 0
)

Variables

View Source
var (
	EndpointTypeEnum = common.NewEnum()
)
View Source
var (
	EntryTypeEnum = common.NewEnum()
)
View Source
var (
	ObjectTypeEnum = common.NewEnum()
)

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	Insert(entry *Entry) error
	FindAll(entry *Entry) ([]*Entry, error)
}

Adapter

type BaseJournal

type BaseJournal struct {
	NOPJournal
	// contains filtered or unexported fields
}

BaseJournal

func NewBaseJournal

func NewBaseJournal(endpointID int32, endpointInstanceID *common.UUID, adapter Adapter) (*BaseJournal, error)

NewBaseJournal

func (*BaseJournal) FindAll

func (j *BaseJournal) FindAll(entry *Entry) ([]*Entry, error)

FindAll

func (*BaseJournal) GetContext

func (j *BaseJournal) GetContext() Contexter

GetContext

func (*BaseJournal) GetContextUUID

func (j *BaseJournal) GetContextUUID() *common.UUID

GetContextUUID

func (*BaseJournal) GetTask

func (j *BaseJournal) GetTask() Tasker

GetTask

func (*BaseJournal) GetTaskUUID

func (j *BaseJournal) GetTaskUUID() *common.UUID

GetTaskUUID

func (*BaseJournal) Insert

func (j *BaseJournal) Insert(entry *Entry) error

Insert

func (*BaseJournal) Lookup

func (j *BaseJournal) Lookup(address *common.Address)

Lookup

func (*BaseJournal) LookupError

func (j *BaseJournal) LookupError(address *common.Address, callErr error)

LookupError

func (*BaseJournal) NewEntry

func (j *BaseJournal) NewEntry(entryType int32) *Entry

NewEntry

func (*BaseJournal) ProcessData

func (j *BaseJournal) ProcessData(
	address *common.Address,
	size int64,
	metadata *common.Metadata,
)

ProcessData journals data processed successfully

func (*BaseJournal) ProcessDataError

func (j *BaseJournal) ProcessDataError(callErr error)

ProcessDataError journals data not processed due to an error

func (*BaseJournal) ProcessTask

func (j *BaseJournal) ProcessTask(task *common.Task)

ProcessTask journals task processed successfully

func (*BaseJournal) ProcessTaskError

func (j *BaseJournal) ProcessTaskError(task *common.Task, callErr error)

ProcessTaskError journals task not processed due to an error

func (*BaseJournal) RequestEnd

func (j *BaseJournal) RequestEnd()

RequestEnd journals request completed successfully

func (*BaseJournal) RequestError

func (j *BaseJournal) RequestError(callErr error)

RequestError journals request has failed with an error

func (*BaseJournal) RequestStart

func (j *BaseJournal) RequestStart()

RequestStart journals beginning of the request processing

func (*BaseJournal) Result

func (j *BaseJournal) Result(
	address *common.Address,
	size int64,
	metadata *common.Metadata,
)

Result journals result

func (*BaseJournal) SaveData

func (j *BaseJournal) SaveData(
	address *common.Address,
	size int64,
	metadata *common.Metadata,
	data []byte,
)

SaveData journals data saved successfully

func (*BaseJournal) SaveDataError

func (j *BaseJournal) SaveDataError(callErr error)

SaveDataError journals data not saved due to an error

func (*BaseJournal) SaveTask

func (j *BaseJournal) SaveTask(task *common.Task)

SaveTask journals task saved successfully

func (*BaseJournal) SaveTaskError

func (j *BaseJournal) SaveTaskError(task *common.Task, callErr error)

SaveTaskError journals task not saved due to an error

func (*BaseJournal) SetContext

func (j *BaseJournal) SetContext(ctx Contexter) Journaller

SetContext

func (*BaseJournal) SetTask

func (j *BaseJournal) SetTask(task Tasker) Journaller

SetTask

func (*BaseJournal) WithContext

func (j *BaseJournal) WithContext(ctx Contexter) Journaller

WithContext

func (*BaseJournal) WithTask

func (j *BaseJournal) WithTask(task Tasker) Journaller

WithTask

type Contexter

type Contexter interface {
	GetUuid() *common.UUID
}

Contexter

type DefaultJournal

type DefaultJournal struct {
	NOPJournal
}

DefaultJournal provides empty implementations of all interface functions

func NewDefaultJournal

func NewDefaultJournal() (*DefaultJournal, error)

NewDefaultJournal

type Entry

type Entry struct {

	// Time of the entry/event
	Time time.Time
	// StartTime specifies start time of the action sequence or execution context
	StartTime time.Time

	// EndpointID [MANDATORY] specifies ID of the endpoint (API call handler/Task processor/etc) which produces the entry
	// See EndpointTypeEnum for available options.
	EndpointID int32
	// EndpointInstanceID [OPTIONAL] specifies ID of the particular endpoint instance (ex.: process) which produces the entry
	// Elaborates EndpointID in terms of particular instance specification.
	EndpointInstanceID *common.UUID
	// SourceID [OPTIONAL] specifies ID of the source (possibly external) of the entry
	SourceID *common.UserID
	// ContextID [OPTIONAL] specifies ID of the execution/rpc context associated with the entry
	ContextUID *common.UUID
	// TaskID [OPTIONAL] specifies ID of the task associated with the entry
	TaskUID *common.UUID
	// Type [MANDATORY] specifies type of the entry - what this entry is about.
	// See EntryTypeEnum for available options.
	Type int32

	// Object info tells about object, if any
	// ObjectType specified object type
	// See ObjectTypeEnum for available options.
	ObjectType     int32
	ObjectAddress  *common.Address
	ObjectSize     uint64
	ObjectMetadata *common.Metadata
	ObjectData     []byte

	// Result [OPTIONAL] specifies result of the operation, specified by Type
	Result string
	// Result [OPTIONAL] specifies status of the operation, specified by Type
	Status string
	// Error [OPTIONAL] tells about error encountered during the operation, specified by Type
	Error error
}

Entry defines journal entry structure

func NewEntry

func NewEntry() *Entry

NewEntry

func (*Entry) EnsureObjectMetadata

func (e *Entry) EnsureObjectMetadata() *common.Metadata

EnsureObjectMetadata

func (*Entry) InsertInto

func (e *Entry) InsertInto(j Journaller)

InsertInto inserts entry into a journal

func (*Entry) SetBaseInfo

func (e *Entry) SetBaseInfo(
	start time.Time,
	endpoint int32,
	endpointInstanceID *common.UUID,
	ctxUID *common.UUID,
	taskUID *common.UUID,
	_type int32,
) *Entry

SetBaseInfo

func (*Entry) SetCtxUID

func (e *Entry) SetCtxUID(ctxUID *common.UUID) *Entry

SetCtxID

func (*Entry) SetEndpointID

func (e *Entry) SetEndpointID(endpoint int32) *Entry

SetEndpointID

func (*Entry) SetEndpointInstanceID

func (e *Entry) SetEndpointInstanceID(endpointInstanceID *common.UUID) *Entry

SetEndpointIInstanceD

func (*Entry) SetError

func (e *Entry) SetError(err error) *Entry

SetError

func (*Entry) SetObject

func (e *Entry) SetObject(
	objectType int32,
	address *common.Address,
	size uint64,
	metadata *common.Metadata,
	data []byte,
) *Entry

SetObject

func (*Entry) SetObjectAddress

func (e *Entry) SetObjectAddress(address *common.Address) *Entry

SetObjectAddress

func (*Entry) SetObjectData

func (e *Entry) SetObjectData(data []byte) *Entry

SetObjectData

func (*Entry) SetObjectMetadata

func (e *Entry) SetObjectMetadata(metadata *common.Metadata) *Entry

SetObjectMetadata

func (*Entry) SetObjectSize

func (e *Entry) SetObjectSize(size uint64) *Entry

SetObjectSize

func (*Entry) SetObjectType

func (e *Entry) SetObjectType(objectType int32) *Entry

SetObjectType

func (*Entry) SetResult

func (e *Entry) SetResult(result string) *Entry

SetResult

func (*Entry) SetSourceID

func (e *Entry) SetSourceID(userID *common.UserID) *Entry

SetSourceID

func (*Entry) SetStatus

func (e *Entry) SetStatus(status string) *Entry

SetStatus

func (*Entry) SetTaskUID

func (e *Entry) SetTaskUID(taskUID *common.UUID) *Entry

SetTaskID

func (*Entry) SetType

func (e *Entry) SetType(_type int32) *Entry

SetType

func (*Entry) String

func (e *Entry) String() string

String

type Journaller

type Journaller interface {
	SetContext(ctx Contexter) Journaller
	SetTask(task Tasker) Journaller
	WithContext(ctx Contexter) Journaller
	WithTask(task Tasker) Journaller

	NewEntry(action int32) *Entry
	Adapter

	RequestStart()
	RequestEnd()
	RequestError(callErr error)

	SaveData(
		address *common.Address,
		size int64,
		metadata *common.Metadata,
		data []byte,
	)
	SaveDataError(callErr error)

	ProcessData(
		address *common.Address,
		size int64,
		metadata *common.Metadata,
	)
	ProcessDataError(callErr error)

	Result(
		address *common.Address,
		size int64,
		metadata *common.Metadata,
	)

	SaveTask(task *common.Task)
	SaveTaskError(task *common.Task, callErr error)

	ProcessTask(task *common.Task)
	ProcessTaskError(task *common.Task, callErr error)

	//
	//
	//
	Lookup(address *common.Address)
	LookupError(address *common.Address, callErr error)
}

Journaller

type NOPJournal

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

NOPJournal

func NewNOPJournal

func NewNOPJournal() (*NOPJournal, error)

NewNOPJournal

func (*NOPJournal) FindAll

func (j *NOPJournal) FindAll(entry *Entry) ([]*Entry, error)

FindAll

func (*NOPJournal) Insert

func (j *NOPJournal) Insert(entry *Entry) error

Insert

func (*NOPJournal) Lookup

func (j *NOPJournal) Lookup(address *common.Address)

Lookup

func (*NOPJournal) LookupError

func (j *NOPJournal) LookupError(address *common.Address, callErr error)

LookupError

func (*NOPJournal) NewEntry

func (j *NOPJournal) NewEntry(action int32) *Entry

NewEntry

func (*NOPJournal) ProcessData

func (j *NOPJournal) ProcessData(
	address *common.Address,
	size int64,
	metadata *common.Metadata,
)

ProcessData journals data processed successfully

func (*NOPJournal) ProcessDataError

func (j *NOPJournal) ProcessDataError(callErr error)

ProcessDataError journals data not processed due to an error

func (*NOPJournal) ProcessTask

func (j *NOPJournal) ProcessTask(task *common.Task)

ProcessTask journals task processed successfully

func (*NOPJournal) ProcessTaskError

func (j *NOPJournal) ProcessTaskError(task *common.Task, callErr error)

ProcessTaskError journals task not processed due to an error

func (*NOPJournal) RequestEnd

func (j *NOPJournal) RequestEnd()

RequestCompleted journals request completed successfully

func (*NOPJournal) RequestError

func (j *NOPJournal) RequestError(callErr error)

RequestError journals request error

func (*NOPJournal) RequestStart

func (j *NOPJournal) RequestStart()

RequestStart journals beginning of the request processing

func (*NOPJournal) Result

func (j *NOPJournal) Result(
	address *common.Address,
	size int64,
	metadata *common.Metadata,
)

Result journals result

func (*NOPJournal) SaveData

func (j *NOPJournal) SaveData(
	address *common.Address,
	size int64,
	metadata *common.Metadata,
	data []byte,
)

SaveData journals data saved successfully

func (*NOPJournal) SaveDataError

func (j *NOPJournal) SaveDataError(callErr error)

SaveDataError journals data not saved due to an error

func (*NOPJournal) SaveTask

func (j *NOPJournal) SaveTask(task *common.Task)

SaveTask journals task saved successfully

func (*NOPJournal) SaveTaskError

func (j *NOPJournal) SaveTaskError(task *common.Task, callErr error)

SaveTaskError journals task not saved due to an error

func (*NOPJournal) SetContext

func (j *NOPJournal) SetContext(ctx Contexter) Journaller

SetContext

func (*NOPJournal) SetTask

func (j *NOPJournal) SetTask(task Tasker) Journaller

SetTask

func (*NOPJournal) WithContext

func (j *NOPJournal) WithContext(ctx Contexter) Journaller

WithContext

func (*NOPJournal) WithTask

func (j *NOPJournal) WithTask(task Tasker) Journaller

WithTask

type Tasker

type Tasker interface {
	GetUuid() *common.UUID
}

Tasker

Directories

Path Synopsis
adapters

Jump to

Keyboard shortcuts

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