core

package
v0.0.0-...-7037cb6 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteArrayToHex

func ByteArrayToHex(bytes []byte) string

Byte array to hex convert helper (used for easy printing)

func GetQualifiedSeriesName

func GetQualifiedSeriesName(domain string, sf string, distributionId uint16, id ident.ID) string

Return the fully qualified data series name from the series id

func GetQualifiers

func GetQualifiers(qualifiedSeriesName string) (string, string, int, string)

Return the qualifiers from the qualified series name

func GetSeriesName

func GetSeriesName(qualifiedSeriesName string) string

Return the series name from the qualified name

func GetSymbolTableName

func GetSymbolTableName(qualifiedSeriesName string) string

Return the symbol table name from the qualified series name

func SingleStreamSymbolTableStreamNameResolver

func SingleStreamSymbolTableStreamNameResolver(qualifiedSeriesId ident.ID) string

Types

type AttributeEncoding

type AttributeEncoding int

Supported attribute encodings

const (
	// Values are encoded as raw unsigned values
	UnsignedNumericValue AttributeEncoding = iota

	// Dictionary encoding. AttributeTable will index into to a dictionary.
	DictionaryEncodedValue
)

type AttributeTable

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

All symbols part of an attribute are indexed seperately.

type M3DBSymStreamReader

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

Implements the SymStreamReader to read the symbol table to an m3db time series

func NewM3DBSymStreamReader

func NewM3DBSymStreamReader(namespace ident.ID, streamId ident.ID, session client.Session) *M3DBSymStreamReader

func (*M3DBSymStreamReader) Next

Read the next instruction from the stream and return the version, sequence number and the instruction. If End of stream is reached, returns NOPInstruction. Otherwise, return error.

func (*M3DBSymStreamReader) ReadAttributeInstruction

func (sr *M3DBSymStreamReader) ReadAttributeInstruction() (string, AttributeEncoding, []uint64, error)

Read AddAttribute instruction parameter from the current position in the stream. If the current instruction is not AddAttribute, return error.

func (*M3DBSymStreamReader) ReadInitInstruction

func (sr *M3DBSymStreamReader) ReadInitInstruction() ([]string, error)

Read InitSymTable instruction parameter from the current position in the stream. If the current instruction is not InitSymTable, return error.

func (*M3DBSymStreamReader) ReadUpdateInstruction

func (sr *M3DBSymStreamReader) ReadUpdateInstruction() ([]string, error)

Read UpdateSymTable instruction parameter from the current position in the stream. If the current instruction is not UpdateSymTable, return error.

func (*M3DBSymStreamReader) Seek

func (sr *M3DBSymStreamReader) Seek(startTime xtime.UnixNano, endTime xtime.UnixNano) error

Seek to first entry between the specified start and end time in the underlying stream.

type M3DBSymStreamWriter

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

Implements the SymStreamWriter to write the symbol table to an m3db time series

func NewM3DBSymStreamWriter

func NewM3DBSymStreamWriter(
	namespace ident.ID,
	streamId ident.ID,
	session client.Session) *M3DBSymStreamWriter

func (*M3DBSymStreamWriter) Wait

func (su *M3DBSymStreamWriter) Wait(timeout time.Duration) error

Wait for all pending write operations to complete or until the specified timeout is reached. If timeout is 0, wait indefinitely until all pending writes are completed.

func (*M3DBSymStreamWriter) WriteAttributeInstruction

func (su *M3DBSymStreamWriter) WriteAttributeInstruction(
	version uint16,
	sequenceNum uint32,
	attributeName string,
	encodingType AttributeEncoding,
	indexValues []uint64,
	completionFn WriteCompletionFn) error

func (*M3DBSymStreamWriter) WriteEndInstruction

func (su *M3DBSymStreamWriter) WriteEndInstruction(
	version uint16,
	sequenceNum uint32,
	completionFn WriteCompletionFn) error

func (*M3DBSymStreamWriter) WriteInitInstruction

func (su *M3DBSymStreamWriter) WriteInitInstruction(
	version uint16,
	attributeValues []string,
	completionFn WriteCompletionFn) error

func (*M3DBSymStreamWriter) WriteUpdateInstruction

func (su *M3DBSymStreamWriter) WriteUpdateInstruction(
	version uint16,
	sequenceNum uint32,
	attributeValues []string,
	completionFn WriteCompletionFn) error

type SeriesFamily

type SeriesFamily interface {

	// Name of the table
	Name() string

	// Namespace of the table
	Namespace() ident.ID

	// Write a float64 value into the table having the specified attributes.
	Write(
		id ident.ID,
		attributes ident.TagIterator,
		time xtime.UnixNano,
		value float64,
		unit xtime.Unit,
		completionFn WriteCompletionFn) error

	// Write a float64 value into the table having the specified tags and
	// attributes.
	WriteTagged(
		id ident.ID,
		tags ident.TagIterator,
		attributes ident.TagIterator,
		time xtime.UnixNano,
		value float64,
		unit xtime.Unit,
		completionFn WriteCompletionFn) error
}

Defines a series family to be used for Transactional & Analytical Processing use case. A series family is a collection of series that shares certain attributes.

type SymStreamReader

type SymStreamReader interface {

	// Seek to first entry between the specified start and end time in the
	// underlying stream.
	Seek(startTime xtime.UnixNano, endTime xtime.UnixNano) error

	// Read the next instruction from the stream and return the version,
	// sequence number and the instruction. If End of stream is reached,
	// returns NOPInstruction. Otherwise, return error.
	Next() (uint16, uint32, TableInstruction, error)

	// Read InitSymTable instruction parameter from the current position in the
	// stream. If the current instruction is not InitSymTable, return error.
	ReadInitInstruction() ([]string, error)

	// Read UpdateSymTable instruction parameter from the current position in
	// the stream. If the current instruction is not UpdateSymTable, return
	// error.
	ReadUpdateInstruction() ([]string, error)

	// Read AddAttribute instruction parameter from the current position in
	// the stream. If the current instruction is not AddAttribute, return
	// error.
	ReadAttributeInstruction() (string, AttributeEncoding, []uint64, error)

	// Read the EndSymTable instruction from the stream at the current
	// location of the underlying stream. Return error if the instruction
	// could not be read.
	ReadEndInstruction() (string, []uint64, error)
}

A Symbol Table Stream Reader provides the interface to read the symbol table operations encoded in the stream.

type SymStreamWriter

type SymStreamWriter interface {

	// Write the InitSymTable instruction with the specified version and
	// attribute values.
	WriteInitInstruction(
		version uint16,
		attributeValues []string,
		completionFn WriteCompletionFn) error

	// Write the UpdateSymTable instruction with the specified version,
	// sequence number and attribute values.
	WriteUpdateInstruction(
		version uint16,
		sequenceNum uint32,
		attributeValues []string,
		completionFn WriteCompletionFn) error

	// Write the AddAttribute instruction with the specified version,
	// sequence number, attribute name, encoding type and index values.
	WriteAttributeInstruction(
		version uint16,
		sequenceNum uint32,
		atributeName string,
		encodingType AttributeEncoding,
		indexValues []uint64,
		completionFn WriteCompletionFn) error

	// Write the EndSymTable instruction with the specified version and
	// sequence number.
	WriteEndInstruction(
		version uint16,
		sequenceNum uint32,
		completionFc WriteCompletionFn) error

	// Wait for all pending write operations to complete or until the specified
	// timeout is reached. If timeout is 0, wait indefinitely wait for all
	// pending writes to complete.
	Wait(timeout time.Duration) error
}

Symbol Stream Writer provides the interface for encoding and writing the symbol table elements into a stream.

type SymTable

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

Symbol Table implementation

func NewSymTable

func NewSymTable(name string, version uint16, streamWriter SymStreamWriter) *SymTable

func (*SymTable) AttributeValueExists

func (sym *SymTable) AttributeValueExists(value string) bool

Returns true if the given attribute value already exists in the symbol table

func (*SymTable) Finalize

func (sym *SymTable) Finalize()

Finalize the symbol table. Once finalized, no more updates can be made

func (*SymTable) FindAttributeIndex

func (sym *SymTable) FindAttributeIndex(name string, value string) int

Find the index of the given attribute value. If the attribute having the specified name or the given value doesn't exist, return -1

func (*SymTable) FindAttributeValue

func (sym *SymTable) FindAttributeValue(name string, index uint64) string

Find the attribute value for the given index. If the attribute having the specified name doesn't exist or the index is out of bounds, return an empty

func (*SymTable) GetAttributesFromIndexedHeader

func (sym *SymTable) GetAttributesFromIndexedHeader(header []int) map[string]string

Return the attribute name and value map for the given indexed header

func (*SymTable) GetIndexedHeader

func (sym *SymTable) GetIndexedHeader(attributes map[string]string) ([]int, bool)

Return the index header for the given set of attributes. If input refers to an attribute that does exist or a value that is not in the symbol table, the corresponding index is set to -1 and will return false

func (*SymTable) InsertAttributeIndices

func (sym *SymTable) InsertAttributeIndices(
	name string,
	indices []uint64,
	writeCompleteFn WriteCompletionFn) error

Insert the attribute values denoted by the given attribute indices into the attribute having the specified name. If the attribute indices are not valid (i.e. they don't exist in the symbol table), this is an error.

func (*SymTable) InsertAttributeValue

func (sym *SymTable) InsertAttributeValue(
	name string,
	value string,
	writeCompleteFn WriteCompletionFn) error

Inserts the given attribute value into the attribute having the specified name. If the attribute name doesn't exist, a new attribute is created in the SymTable. If the value already exists, this is a NOP

func (*SymTable) IsSame

func (sym *SymTable) IsSame(other *SymTable) bool

Return true if the specified other symbol table is the same as this one Two symbol tables are the same if they encode the same symbols and attribute values

func (*SymTable) Name

func (sym *SymTable) Name() string

Returns the name of the symbol table

func (*SymTable) NumAttributes

func (sym *SymTable) NumAttributes() int

Returns the number of attributes in the symbol table

func (*SymTable) NumSymbols

func (sym *SymTable) NumSymbols() int

Returns the number of symbols in the symbol table

func (*SymTable) UpdateDictionary

func (sym *SymTable) UpdateDictionary(
	attributeValues []string,
	writeCompleteFn WriteCompletionFn) error

Update the dictionary with the given attribute values. If the attribute values already exists in the dictionary, this is an error

func (*SymTable) Version

func (sym *SymTable) Version() uint16

Return the version of the symbol table

func (*SymTable) Wait

func (sym *SymTable) Wait(timeout time.Duration)

Wait for all pending write operations to complete or until the specified timeout is reached. If timeout is 0, wait indefinitely wait for all pending writes to complete.

type SymbolTableStreamNameResolver

type SymbolTableStreamNameResolver func(qualifiedSeriesId ident.ID) string

Resolves the name of the symbol table stream for the given series id

type TableInstruction

type TableInstruction int

Symbol Table Instructions supported by the boost implementation

const (
	// Initiatize the table
	InitSymTable TableInstruction = iota

	// Update the table
	UpdateSymTable

	// Add a new attribute to the table
	AddAttribute

	// End Dictionary
	EndSymTable

	// NOP
	NOPInstruction
)

type WriteCompletionFn

type WriteCompletionFn func(err error)

Jump to

Keyboard shortcuts

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