model

package
v1.7.14 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HEADER = 0x75

	// tag type
	TAG_ROW_PK             = 0x1
	TAG_ROW_DATA           = 0x2
	TAG_CELL               = 0x3
	TAG_CELL_NAME          = 0x4
	TAG_CELL_VALUE         = 0x5
	TAG_CELL_TYPE          = 0x6
	TAG_CELL_TIMESTAMP     = 0x7
	TAG_DELETE_ROW_MARKER  = 0x8
	TAG_ROW_CHECKSUM       = 0x9
	TAG_CELL_CHECKSUM      = 0x0A
	TAG_EXTENSION          = 0x0B
	TAG_SEQ_INFO           = 0x0C
	TAG_SEQ_INFO_EPOCH     = 0x0D
	TAG_SEQ_INFO_TS        = 0x0E
	TAG_SEQ_INFO_ROW_INDEX = 0x0F

	// cell op type
	DELETE_ALL_VERSION = 0x1
	DELETE_ONE_VERSION = 0x3
	INCREMENT          = 0x4

	// variant type
	VT_INTEGER = 0x0
	VT_DOUBLE  = 0x1
	VT_BOOLEAN = 0x2
	VT_STRING  = 0x3

	//public final static byte VT_NULL = 0x6;
	VT_BLOB           = 0x7
	VT_INF_MIN        = 0x9
	VT_INF_MAX        = 0xa
	VT_AUTO_INCREMENT = 0xb

	LITTLE_ENDIAN_32_SIZE = 4
	LITTLE_ENDIAN_64_SIZE = 8
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionType

type ActionType int
const (
	AT_Put ActionType = iota
	AT_Update
	AT_Delete
)

func (ActionType) String

func (this ActionType) String() string

type AttributeColumn

type AttributeColumn struct {
	ColumnName string
	Value      interface{}
	Timestamp  int64
}

type BatchGetRowRequest

type BatchGetRowRequest struct {
	MultiRowQueryCriteria []*MultiRowQueryCriteria
}

type Column

type Column struct {
	Name         []byte
	Value        ColumnValue
	Type         byte
	Timestamp    int64
	HasType      bool
	HasTimestamp bool
	IgnoreValue  bool
}

func NewColumn

func NewColumn(name []byte, value interface{}) *Column

type ColumnFilter

type ColumnFilter interface {
	Serialize() []byte
	ToFilter() *otsprotocol.Filter
}

type ColumnMap

type ColumnMap struct {
	Columns map[string][]*AttributeColumn
	// contains filtered or unexported fields
}

func (*ColumnMap) GetRange

func (columnMap *ColumnMap) GetRange(start int, count int) ([]*AttributeColumn, error)

type ColumnToUpdate

type ColumnToUpdate struct {
	ColumnName   string
	Type         byte
	Timestamp    int64
	HasType      bool
	HasTimestamp bool
	IgnoreValue  bool
	Value        interface{}
}

type ColumnType

type ColumnType int32
const (
	ColumnType_STRING  ColumnType = 1
	ColumnType_INTEGER ColumnType = 2
	ColumnType_BOOLEAN ColumnType = 3
	ColumnType_DOUBLE  ColumnType = 4
	ColumnType_BINARY  ColumnType = 5
)

type ColumnValue

type ColumnValue struct {
	Type  ColumnType
	Value interface{}
}

func (*ColumnValue) WriteCellValueWithoutLengthPrefix

func (cv *ColumnValue) WriteCellValueWithoutLengthPrefix() []byte

type ComparatorType

type ComparatorType int32
const (
	CT_EQUAL         ComparatorType = 1
	CT_NOT_EQUAL     ComparatorType = 2
	CT_GREATER_THAN  ComparatorType = 3
	CT_GREATER_EQUAL ComparatorType = 4
	CT_LESS_THAN     ComparatorType = 5
	CT_LESS_EQUAL    ComparatorType = 6
)

func (*ComparatorType) ConvertToPbComparatorType

func (comparatorType *ComparatorType) ConvertToPbComparatorType() otsprotocol.ComparatorType

type ComputeSplitsRequest

type ComputeSplitsRequest struct {
	TableName string
	// contains filtered or unexported fields
}

type DateTimeUnit added in v1.7.10

type DateTimeUnit int32
const (
	DateTimeUnit_YEAR         DateTimeUnit = 1
	DateTimeUnit_QUARTER_YEAR DateTimeUnit = 2
	DateTimeUnit_MONTH        DateTimeUnit = 3
	DateTimeUnit_WEEK         DateTimeUnit = 4
	DateTimeUnit_DAY          DateTimeUnit = 5
	DateTimeUnit_HOUR         DateTimeUnit = 6
	DateTimeUnit_MINUTE       DateTimeUnit = 7
	DateTimeUnit_SECOND       DateTimeUnit = 8
)

func (DateTimeUnit) Enum added in v1.7.10

func (d DateTimeUnit) Enum() *DateTimeUnit

func (*DateTimeUnit) ProtoBuffer added in v1.7.10

func (d *DateTimeUnit) ProtoBuffer() *otsprotocol.DateTimeUnit

type DateTimeValue added in v1.7.10

type DateTimeValue struct {
	Value *int32
	Unit  *DateTimeUnit
}

func (*DateTimeValue) ProtoBuffer added in v1.7.10

func (d *DateTimeValue) ProtoBuffer() *otsprotocol.DateTimeValue

type DefinedColumnSchema

type DefinedColumnSchema struct {
	Name       string
	ColumnType DefinedColumnType
}

type DefinedColumnType

type DefinedColumnType int32
const (
	/**
	 * 64位整数。
	 */
	DefinedColumn_INTEGER DefinedColumnType = 1

	/**
	 * 浮点数。
	 */
	DefinedColumn_DOUBLE DefinedColumnType = 2

	/**
	 * 布尔值。
	 */
	DefinedColumn_BOOLEAN DefinedColumnType = 3

	/**
	 * 字符串。
	 */
	DefinedColumn_STRING DefinedColumnType = 4

	/**
	 * BINARY。
	 */
	DefinedColumn_BINARY DefinedColumnType = 5
)

func (DefinedColumnType) ConvertToPbDefinedColumnType

func (columnType DefinedColumnType) ConvertToPbDefinedColumnType() otsprotocol.DefinedColumnType

type DeleteRowChange

type DeleteRowChange struct {
	TableName     string
	PrimaryKey    *PrimaryKey
	Condition     *RowCondition
	TransactionId *string
}

func (*DeleteRowChange) GetTableName

func (rowchange *DeleteRowChange) GetTableName() string

func (*DeleteRowChange) Serialize

func (rowchange *DeleteRowChange) Serialize() []byte

func (*DeleteRowChange) SetColumnCondition

func (rowchange *DeleteRowChange) SetColumnCondition(condition ColumnFilter)

func (*DeleteRowChange) SetCondition

func (rowchange *DeleteRowChange) SetCondition(rowExistenceExpectation RowExistenceExpectation)

type DeleteRowRequest

type DeleteRowRequest struct {
	DeleteRowChange *DeleteRowChange
}

type Direction

type Direction int32
const (
	FORWARD  Direction = 0
	BACKWARD Direction = 1
)

func (Direction) ToDirection

func (direction Direction) ToDirection() otsprotocol.Direction

type Error

type Error struct {
	Code    string
	Message string
}

type FiledRange

type FiledRange struct {
	Min interface{}
	Max interface{}
}

type FilterType

type FilterType int32

type GeoHashPrecision added in v1.7.12

type GeoHashPrecision int32
const (
	GHP_5009KM_4992KM_1 GeoHashPrecision = 1
	GHP_1252KM_624KM_2  GeoHashPrecision = 2
	GHP_156KM_156KM_3   GeoHashPrecision = 3
	GHP_39KM_19KM_4     GeoHashPrecision = 4
	GHP_4900M_4900M_5   GeoHashPrecision = 5
	GHP_1200M_609M_6    GeoHashPrecision = 6
	GHP_152M_152M_7     GeoHashPrecision = 7
	GHP_38M_19M_8       GeoHashPrecision = 8
	GHP_480CM_480CM_9   GeoHashPrecision = 9
	GHP_120CM_595MM_10  GeoHashPrecision = 10
	GHP_149MM_149MM_11  GeoHashPrecision = 11
	GHP_37MM_19MM_12    GeoHashPrecision = 12
)

func (*GeoHashPrecision) ProtoBuffer added in v1.7.12

func (d *GeoHashPrecision) ProtoBuffer() *otsprotocol.GeoHashPrecision

type GetRangeRequest

type GetRangeRequest struct {
	RangeRowQueryCriteria *RangeRowQueryCriteria
}

type GetRowRequest

type GetRowRequest struct {
	SingleRowQueryCriteria *SingleRowQueryCriteria
}

type IndexMeta

type IndexMeta struct {
	IndexName      string
	Primarykey     []string
	DefinedColumns []string
	IndexType      IndexType
}

func (*IndexMeta) ConvertToPbIndexMeta

func (meta *IndexMeta) ConvertToPbIndexMeta() *otsprotocol.IndexMeta

type IndexType

type IndexType int32

type LogicalOperator

type LogicalOperator int32
const (
	LO_NOT LogicalOperator = 1
	LO_AND LogicalOperator = 2
	LO_OR  LogicalOperator = 3
)

func (*LogicalOperator) ConvertToPbLoType

func (loType *LogicalOperator) ConvertToPbLoType() otsprotocol.LogicalOperator

type MultiRowQueryCriteria

type MultiRowQueryCriteria struct {
	PrimaryKey   []*PrimaryKey
	ColumnsToGet []string
	TableName    string
	MaxVersion   int
	TimeRange    *TimeRange
	Filter       ColumnFilter
	StartColumn  *string
	EndColumn    *string
}

func (*MultiRowQueryCriteria) AddColumnToGet

func (rowQueryCriteria *MultiRowQueryCriteria) AddColumnToGet(columnName string)

func (*MultiRowQueryCriteria) AddRow

func (rowQueryCriteria *MultiRowQueryCriteria) AddRow(pk *PrimaryKey)

func (*MultiRowQueryCriteria) SetFilter

func (Criteria *MultiRowQueryCriteria) SetFilter(filter ColumnFilter)

type OtsError

type OtsError struct {
	Code      string
	Message   string
	RequestId string

	HttpStatusCode int
}

func (*OtsError) Error

func (e *OtsError) Error() string

type PlainBufferCell

type PlainBufferCell struct {
	CellName         []byte
	CellValue        *ColumnValue
	CellTimestamp    int64
	CellType         byte
	IgnoreValue      bool
	HasCellTimestamp bool
	HasCellType      bool
}

type PlainBufferRow

type PlainBufferRow struct {
	PrimaryKey      []*PlainBufferCell
	Cells           []*PlainBufferCell
	HasDeleteMarker bool
	Extension       *RecordSequenceInfo // optional
}

func ReadRowsWithHeader

func ReadRowsWithHeader(r *bytes.Reader) (rows []*PlainBufferRow, err error)

type PrimaryKey

type PrimaryKey struct {
	PrimaryKeys []*PrimaryKeyColumn
}

func (*PrimaryKey) AddPrimaryKeyColumn

func (pk *PrimaryKey) AddPrimaryKeyColumn(primaryKeyName string, value interface{})

func (*PrimaryKey) AddPrimaryKeyColumnWithAutoIncrement

func (pk *PrimaryKey) AddPrimaryKeyColumnWithAutoIncrement(primaryKeyName string)

func (*PrimaryKey) AddPrimaryKeyColumnWithMaxValue

func (pk *PrimaryKey) AddPrimaryKeyColumnWithMaxValue(primaryKeyName string)

Only used for range query

func (*PrimaryKey) AddPrimaryKeyColumnWithMinValue

func (pk *PrimaryKey) AddPrimaryKeyColumnWithMinValue(primaryKeyName string)

func (*PrimaryKey) Build

func (pk *PrimaryKey) Build(isDelete bool) []byte

type PrimaryKey2

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

type PrimaryKeyColumn

type PrimaryKeyColumn struct {
	ColumnName       string
	Value            interface{}
	PrimaryKeyOption PrimaryKeyOption
}

func (*PrimaryKeyColumn) String

func (this *PrimaryKeyColumn) String() string

type PrimaryKeyColumnInner

type PrimaryKeyColumnInner struct {
	Name  []byte
	Type  otsprotocol.PrimaryKeyType
	Value interface{}
}

func NewPrimaryKeyColumn

func NewPrimaryKeyColumn(name []byte, value interface{}, option PrimaryKeyOption) *PrimaryKeyColumnInner

func NewPrimaryKeyColumnAuto_Increment

func NewPrimaryKeyColumnAuto_Increment(name []byte) *PrimaryKeyColumnInner

func NewPrimaryKeyColumnINF_MAX

func NewPrimaryKeyColumnINF_MAX(name []byte) *PrimaryKeyColumnInner

func NewPrimaryKeyColumnINF_MIN

func NewPrimaryKeyColumnINF_MIN(name []byte) *PrimaryKeyColumnInner

type PrimaryKeyOption

type PrimaryKeyOption int32
const (
	NONE           PrimaryKeyOption = 0
	AUTO_INCREMENT PrimaryKeyOption = 1
	MIN            PrimaryKeyOption = 2
	MAX            PrimaryKeyOption = 3
)

type PrimaryKeyType

type PrimaryKeyType int32

type PutRowChange

type PutRowChange struct {
	TableName     string
	PrimaryKey    *PrimaryKey
	Columns       []AttributeColumn
	Condition     *RowCondition
	ReturnType    ReturnType
	TransactionId *string
}

func (*PutRowChange) AddColumn

func (rowchange *PutRowChange) AddColumn(columnName string, value interface{})

value only support int64,string,bool,float64,[]byte. other type will get panic

func (*PutRowChange) AddColumnWithTimestamp

func (rowchange *PutRowChange) AddColumnWithTimestamp(columnName string, value interface{}, timestamp int64)

value only support int64,string,bool,float64,[]byte. other type will get panic

func (*PutRowChange) GetTableName

func (rowchange *PutRowChange) GetTableName() string

func (*PutRowChange) Serialize

func (rowchange *PutRowChange) Serialize() []byte

func (*PutRowChange) SetColumnCondition

func (rowchange *PutRowChange) SetColumnCondition(condition ColumnFilter)

func (*PutRowChange) SetCondition

func (rowchange *PutRowChange) SetCondition(rowExistenceExpectation RowExistenceExpectation)

func (*PutRowChange) SetReturnPk

func (rowchange *PutRowChange) SetReturnPk()

type PutRowRequest

type PutRowRequest struct {
	PutRowChange *PutRowChange
}

type RangeRowQueryCriteria

type RangeRowQueryCriteria struct {
	TableName       string
	StartPrimaryKey *PrimaryKey
	EndPrimaryKey   *PrimaryKey
	ColumnsToGet    []string
	MaxVersion      int32
	TimeRange       *TimeRange
	Filter          ColumnFilter
	Direction       Direction
	Limit           int32
	StartColumn     *string
	EndColumn       *string
	TransactionId   *string
}

func (*RangeRowQueryCriteria) AddColumnToGet

func (rowQueryCriteria *RangeRowQueryCriteria) AddColumnToGet(columnName string)

type RecordColumn

type RecordColumn struct {
	Type      RecordColumnType
	Name      *string     // required
	Value     interface{} // optional. present when Type is RCT_Put
	Timestamp *int64      // optional, in msec. present when Type is RCT_Put or RCT_DeleteOneVersion
}

func (*RecordColumn) String

func (this *RecordColumn) String() string

type RecordColumnType

type RecordColumnType int
const (
	RCT_Put RecordColumnType = iota
	RCT_DeleteOneVersion
	RCT_DeleteAllVersions
)

type RecordSequenceInfo

type RecordSequenceInfo struct {
	Epoch     int32
	Timestamp int64
	RowIndex  int32
}

func (*RecordSequenceInfo) String

func (this *RecordSequenceInfo) String() string

type ReturnType

type ReturnType int32
const (
	ReturnType_RT_NONE         ReturnType = 0
	ReturnType_RT_PK           ReturnType = 1
	ReturnType_RT_AFTER_MODIFY ReturnType = 2
)

type Row

type Row struct {
	PrimaryKey *PrimaryKey
	Columns    []*AttributeColumn
}

type RowChange

type RowChange interface {
	Serialize() []byte

	GetTableName() string
	// contains filtered or unexported methods
}

type RowCondition

type RowCondition struct {
	RowExistenceExpectation RowExistenceExpectation
	ColumnCondition         ColumnFilter
}

type RowExistenceExpectation

type RowExistenceExpectation int
const (
	RowExistenceExpectation_IGNORE           RowExistenceExpectation = 0
	RowExistenceExpectation_EXPECT_EXIST     RowExistenceExpectation = 1
	RowExistenceExpectation_EXPECT_NOT_EXIST RowExistenceExpectation = 2
)

type RowPutChange

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

func (*RowPutChange) Build

func (rpc *RowPutChange) Build() []byte

type RowUpdateChange

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

func (*RowUpdateChange) Build

func (ruc *RowUpdateChange) Build() []byte

type SearchIndexSplitsOptions

type SearchIndexSplitsOptions struct {
	IndexName string
}

compute splits

type ShardId

type ShardId string

type ShardIterator

type ShardIterator string

type SingleColumnCondition

type SingleColumnCondition struct {
	Comparator        *ComparatorType
	ColumnName        *string
	ColumnValue       interface{} //[]byte
	FilterIfMissing   bool
	LatestVersionOnly bool
	TransferRule      *ValueTransferRule
}

type SingleRowQueryCriteria

type SingleRowQueryCriteria struct {
	ColumnsToGet  []string
	TableName     string
	PrimaryKey    *PrimaryKey
	MaxVersion    int32
	TimeRange     *TimeRange
	Filter        ColumnFilter
	StartColumn   *string
	EndColumn     *string
	TransactionId *string
}

func (*SingleRowQueryCriteria) AddColumnToGet

func (rowQueryCriteria *SingleRowQueryCriteria) AddColumnToGet(columnName string)

func (*SingleRowQueryCriteria) SetEndtColumn

func (rowQueryCriteria *SingleRowQueryCriteria) SetEndtColumn(columnName string)

func (*SingleRowQueryCriteria) SetFilter

func (Criteria *SingleRowQueryCriteria) SetFilter(filter ColumnFilter)

func (*SingleRowQueryCriteria) SetStartColumn

func (rowQueryCriteria *SingleRowQueryCriteria) SetStartColumn(columnName string)

type Split

type Split struct {
	LowerBound *PrimaryKey
	UpperBound *PrimaryKey
	Location   string
}

type StartLocalTransactionRequest

type StartLocalTransactionRequest struct {
	PrimaryKey *PrimaryKey
	TableName  string
}

type StreamDetails

type StreamDetails struct {
	EnableStream   bool
	StreamId       *StreamId // nil when stream is disabled.
	ExpirationTime int32     // in hours
	LastEnableTime int64     // the last time stream is enabled, in usec
}

type StreamId

type StreamId string

type StreamRecord

type StreamRecord struct {
	Type       ActionType
	Info       *RecordSequenceInfo // required
	PrimaryKey *PrimaryKey         // required
	Columns    []*RecordColumn
}

func (*StreamRecord) String

func (this *StreamRecord) String() string

type StreamShard

type StreamShard struct {
	SelfShard   *ShardId // required
	FatherShard *ShardId // optional
	MotherShard *ShardId // optional
}

* Shards are possibly splitted into two or merged from two. * After splitting, both newly generated shards have the same FatherShard. * After merging, the newly generated shard have both FatherShard and MotherShard.

type StreamSpecification

type StreamSpecification struct {
	EnableStream   bool
	ExpirationTime int32 // must be positive. in hours
}

type StreamStatus

type StreamStatus int

type TimeRange

type TimeRange struct {
	Start    int64
	End      int64
	Specific int64
}

type UpdateRowChange

type UpdateRowChange struct {
	TableName           string
	PrimaryKey          *PrimaryKey
	Columns             []ColumnToUpdate
	Condition           *RowCondition
	TransactionId       *string
	ReturnType          ReturnType
	ColumnNamesToReturn []string
}

func (*UpdateRowChange) AppendIncrementColumnToReturn

func (rowchange *UpdateRowChange) AppendIncrementColumnToReturn(name string)

func (*UpdateRowChange) DeleteColumn

func (rowchange *UpdateRowChange) DeleteColumn(columnName string)

func (*UpdateRowChange) DeleteColumnWithTimestamp

func (rowchange *UpdateRowChange) DeleteColumnWithTimestamp(columnName string, timestamp int64)

func (*UpdateRowChange) GetTableName

func (rowchange *UpdateRowChange) GetTableName() string

func (*UpdateRowChange) IncrementColumn

func (rowchange *UpdateRowChange) IncrementColumn(columnName string, value int64)

func (*UpdateRowChange) PutColumn

func (rowchange *UpdateRowChange) PutColumn(columnName string, value interface{})

value only support int64,string,bool,float64,[]byte. other type will get panic

func (*UpdateRowChange) Serialize

func (rowchange *UpdateRowChange) Serialize() []byte

func (*UpdateRowChange) SetColumnCondition

func (rowchange *UpdateRowChange) SetColumnCondition(condition ColumnFilter)

func (*UpdateRowChange) SetCondition

func (rowchange *UpdateRowChange) SetCondition(rowExistenceExpectation RowExistenceExpectation)

func (*UpdateRowChange) SetReturnIncrementValue

func (rowchange *UpdateRowChange) SetReturnIncrementValue()

type UpdateRowRequest

type UpdateRowRequest struct {
	UpdateRowChange *UpdateRowChange
}

type ValueTransferRule

type ValueTransferRule struct {
	Regex     string
	Cast_type VariantType
}

type VariantType

type VariantType int32

Jump to

Keyboard shortcuts

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