models

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2025 License: Apache-2.0 Imports: 7 Imported by: 8

Documentation

Index

Constants

View Source
const (
	// VoidTimeNeverExpire is used when a record should never expire.
	VoidTimeNeverExpire int64 = 0
	// ExpirationNever is the Aerospike server's special TTL value for records
	// that should never expire.
	ExpirationNever uint32 = math.MaxUint32
)
View Source
const MonitorRecordsSetName = "<ERO~MRT"

MonitorRecordsSetName represents the MRT monitor set name.

Variables

View Source
var ErrFilteredOut = errors.New("filtered out")

ErrFilteredOut is returned by a Data Processor when a token should be filtered out of the pipeline.

Functions

This section is empty.

Types

type ASBXToken

type ASBXToken struct {
	Key     *a.Key
	Payload []byte
}

ASBXToken represents data received from XDR or RAW payload data.

func NewASBXToken

func NewASBXToken(key *a.Key, payload []byte) *ASBXToken

NewASBXToken creates new ASBX Token from XDR or RAW payload data.

func (*ASBXToken) GetSize

func (t *ASBXToken) GetSize() uint64

type BackupStats

type BackupStats struct {

	// total number of records in database
	TotalRecords atomic.Uint64
	// contains filtered or unexported fields
}

BackupStats stores the status of a backup job. Stats are updated in realtime by backup jobs.

func NewBackupStats

func NewBackupStats() *BackupStats

NewBackupStats returns new backup stats.

func SumBackupStats

func SumBackupStats(stats ...*BackupStats) *BackupStats

SumBackupStats combines multiple BackupStats.

func (BackupStats) AddSIndexes

func (s BackupStats) AddSIndexes(num uint32)

func (BackupStats) AddUDFs

func (s BackupStats) AddUDFs(num uint32)

func (BackupStats) GetBytesWritten

func (s BackupStats) GetBytesWritten() uint64

func (BackupStats) GetDuration

func (s BackupStats) GetDuration() time.Duration

func (*BackupStats) GetFileCount

func (b *BackupStats) GetFileCount() uint64

GetFileCount returns the number of files per backup.

func (BackupStats) GetReadRecords

func (s BackupStats) GetReadRecords() uint64

func (BackupStats) GetSIndexes

func (s BackupStats) GetSIndexes() uint32

func (BackupStats) GetUDFs

func (s BackupStats) GetUDFs() uint32

func (*BackupStats) IncFiles

func (b *BackupStats) IncFiles()

IncFiles increments by one the number of files per backup.

func (*BackupStats) IsEmpty

func (b *BackupStats) IsEmpty() bool

IsEmpty determines whether the BackupStats is empty.

func (BackupStats) Start

func (s BackupStats) Start()

func (BackupStats) Stop

func (s BackupStats) Stop()

type File

type File struct {
	Name   string
	Reader io.ReadCloser
}

File represents a file with name and reader.

type Metrics

type Metrics struct {
	PipelineReadQueueSize  int
	PipelineWriteQueueSize int
	RecordsPerSecond       uint64
	KilobytesPerSecond     uint64
}

Metrics contains app metrics.

func NewMetrics

func NewMetrics(
	pr, pw int,
	rps, kbps uint64,
) *Metrics

NewMetrics returns a new Metrics with the provided values.

func SumMetrics

func SumMetrics(metrics ...*Metrics) *Metrics

SumMetrics returns a new Metrics object that is the sum of Metrics.

type PartitionFilterSerialized

type PartitionFilterSerialized struct {
	Begin  int
	Count  int
	Digest []byte
	Cursor []byte
	// Worker number.
	N int
}

PartitionFilterSerialized represent serialized a.PartitionFilter. To save cursor state.

func NewPartitionFilterSerialized

func NewPartitionFilterSerialized(pf *a.PartitionFilter) (PartitionFilterSerialized, error)

NewPartitionFilterSerialized serialize *a.PartitionFilter and returns new PartitionFilterSerialized instance.

func (*PartitionFilterSerialized) Decode

Decode decodes *PartitionFilterSerialized to *a.PartitionFilter

func (*PartitionFilterSerialized) IsEmpty

func (p *PartitionFilterSerialized) IsEmpty() bool

type Record

type Record struct {
	*a.Record

	// VoidTime is the time in seconds since the citrusleaf epoch when the
	// record will expire.
	VoidTime int64
}

type RestoreStats

type RestoreStats struct {

	// The number of records dropped because they were expired.
	RecordsExpired atomic.Uint64
	// The number of records dropped because they didn't contain any of the
	// selected bins or didn't belong to any of the selected sets.
	RecordsSkipped atomic.Uint64
	// The number of records ignored because of record level permanent error while
	// restoring.
	// E.g.: if RestoreConfig.IgnoreRecordError = true.
	RecordsIgnored atomic.Uint64

	// Total number of bytes read from source.
	TotalBytesRead atomic.Uint64
	// contains filtered or unexported fields
}

RestoreStats stores the stats of a restore operation from the reader job.

func NewRestoreStats

func NewRestoreStats() *RestoreStats

NewRestoreStats returns new restore stats.

func SumRestoreStats

func SumRestoreStats(stats ...*RestoreStats) *RestoreStats

SumRestoreStats combines multiple RestoreStats.

func (RestoreStats) AddSIndexes

func (s RestoreStats) AddSIndexes(num uint32)

func (RestoreStats) AddUDFs

func (s RestoreStats) AddUDFs(num uint32)

func (RestoreStats) GetBytesWritten

func (s RestoreStats) GetBytesWritten() uint64

func (RestoreStats) GetDuration

func (s RestoreStats) GetDuration() time.Duration

func (*RestoreStats) GetErrorsInDoubt

func (rs *RestoreStats) GetErrorsInDoubt() uint64

func (RestoreStats) GetReadRecords

func (s RestoreStats) GetReadRecords() uint64

func (*RestoreStats) GetRecordsExisted

func (rs *RestoreStats) GetRecordsExisted() uint64

func (*RestoreStats) GetRecordsExpired

func (rs *RestoreStats) GetRecordsExpired() uint64

func (*RestoreStats) GetRecordsFresher

func (rs *RestoreStats) GetRecordsFresher() uint64

func (*RestoreStats) GetRecordsIgnored

func (rs *RestoreStats) GetRecordsIgnored() uint64

func (*RestoreStats) GetRecordsInserted

func (rs *RestoreStats) GetRecordsInserted() uint64

func (*RestoreStats) GetRecordsSkipped

func (rs *RestoreStats) GetRecordsSkipped() uint64

func (RestoreStats) GetSIndexes

func (s RestoreStats) GetSIndexes() uint32

func (*RestoreStats) GetTotalBytesRead

func (rs *RestoreStats) GetTotalBytesRead() uint64

func (RestoreStats) GetUDFs

func (s RestoreStats) GetUDFs() uint32

func (*RestoreStats) IncrErrorsInDoubt

func (rs *RestoreStats) IncrErrorsInDoubt()

func (*RestoreStats) IncrRecordsExisted

func (rs *RestoreStats) IncrRecordsExisted()

func (*RestoreStats) IncrRecordsFresher

func (rs *RestoreStats) IncrRecordsFresher()

func (*RestoreStats) IncrRecordsIgnored

func (rs *RestoreStats) IncrRecordsIgnored()

func (*RestoreStats) IncrRecordsInserted

func (rs *RestoreStats) IncrRecordsInserted()

func (RestoreStats) Start

func (s RestoreStats) Start()

func (RestoreStats) Stop

func (s RestoreStats) Stop()

type RetryPolicy

type RetryPolicy struct {
	// BaseTimeout is the initial delay between retry attempts.
	BaseTimeout time.Duration

	// Multiplier is used to increase the delay between subsequent retry attempts.
	// The actual delay is calculated as: BaseTimeout * (Multiplier ^ attemptNumber)
	Multiplier float64

	// MaxRetries is the maximum number of retry attempts that will be made.
	// If set to 0, no retries will be performed.
	MaxRetries uint
}

RetryPolicy defines the configuration for retry attempts in case of failures.

func NewDefaultRetryPolicy

func NewDefaultRetryPolicy() *RetryPolicy

NewDefaultRetryPolicy returns a new RetryPolicy with default values.

func NewRetryPolicy

func NewRetryPolicy(baseTimeout time.Duration, multiplier float64, maxRetries uint) *RetryPolicy

NewRetryPolicy returns new configuration for retry attempts in case of failures.

func (*RetryPolicy) Validate

func (p *RetryPolicy) Validate() error

Validate checks retry policy values.

type SIPathBinType

type SIPathBinType byte
const (
	InvalidSIDataType     SIPathBinType = 0
	NumericSIDataType     SIPathBinType = 'N'
	StringSIDataType      SIPathBinType = 'S'
	GEO2DSphereSIDataType SIPathBinType = 'G'
	BlobSIDataType        SIPathBinType = 'B'
)

type SIndex

type SIndex struct {
	Namespace  string
	Set        string
	Name       string
	Path       SIndexPath
	IndexType  SIndexType
	Expression string
}

type SIndexPath

type SIndexPath struct {
	BinName    string
	B64Context string
	BinType    SIPathBinType
}

type SIndexType

type SIndexType byte
const (
	InvalidSIndex     SIndexType = 0
	BinSIndex         SIndexType = 'N'
	ListElementSIndex SIndexType = 'L'
	MapKeySIndex      SIndexType = 'K'
	MapValueSIndex    SIndexType = 'V'
)

type Sizer

type Sizer interface {
	GetSize() uint64
}

type TimeBounds

type TimeBounds struct {
	FromTime *time.Time
	ToTime   *time.Time
}

TimeBounds represents a period of time between two timestamps.

type Token

type Token struct {
	SIndex *SIndex
	UDF    *UDF
	Record *Record
	Type   TokenType
	Size   uint64
	// Filter represents serialized partition filter for page, that record belongs to.
	// Is used only on pagination read, to save reading states.
	Filter *PartitionFilterSerialized
}

Token encompasses the other data models. The fields should be accessed based on the tokenType.

func NewRecordToken

func NewRecordToken(r *Record, size uint64, filter *PartitionFilterSerialized) *Token

NewRecordToken creates a new token with the given record.

func NewSIndexToken

func NewSIndexToken(s *SIndex, size uint64) *Token

NewSIndexToken creates a new token with the given secondary index.

func NewUDFToken

func NewUDFToken(u *UDF, size uint64) *Token

NewUDFToken creates a new token with the given UDF.

func (*Token) GetSize

func (t *Token) GetSize() uint64

type TokenConstraint

type TokenConstraint interface {
	Sizer
	*Token | *ASBXToken
}

type TokenType

type TokenType uint8
const (
	TokenTypeInvalid TokenType = iota
	TokenTypeRecord
	TokenTypeSIndex
	TokenTypeUDF
)

type UDF

type UDF struct {
	Name    string
	Content []byte
	UDFType UDFType
}

type UDFType

type UDFType byte
const (
	UDFTypeLUA UDFType = 'L'
)

Jump to

Keyboard shortcuts

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