Documentation
¶
Index ¶
- Constants
- Variables
- func ErrorToGRPC(err error) error
- func MeasureSince(o prometheus.Observer, t1 time.Time)
- func ReadProtoMessageFromStream[T ptr[U], U any](r io.Reader) (T, error)
- func ReadUint32FromStream(r io.Reader) (uint32, error)
- func Restore(s *store.BadgerStore, ranges []KeyRange, reader io.ReadCloser) error
- func WriteProtoMessageIntoStream(w io.Writer, msg encoding.BinaryMarshaler) error
- func WriteUint32IntoStream(w io.Writer, i uint32) error
- type BadgerStoreSnapshot
- type BinaryTable
- func (t *BinaryTable[T, U]) Delete(txn *store.Txn, key []byte) error
- func (t *BinaryTable[T, U]) Get(txn *store.Txn, key []byte) (T, error)
- func (t *BinaryTable) GetTableKeyRange() KeyRange
- func (t *BinaryTable[T, U]) ListAll(txn *store.Txn, prefix []byte) ([]T, error)
- func (t *BinaryTable[T, U]) ListInRange(txn *store.Txn, lowerBound []byte, upperBound []byte, reverse bool, ...) error
- func (t *BinaryTable[T, U]) ListPaginated(txn *store.Txn, prefix []byte, paginationToken *PaginationToken, limit int) (*ListPaginatedProtobufResult[T, U], error)
- func (t *BinaryTable[T, U]) Set(txn *store.Txn, key []byte, message T) error
- type Error
- func (*Error) Descriptor() ([]byte, []int)deprecated
- func (e *Error) Error() string
- func (x *Error) GetCode() ErrorCode
- func (x *Error) GetContext() []*ErrorContext
- func (x *Error) GetMessage() string
- func (m *Error) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Error) MarshalToVT(dAtA []byte) (int, error)
- func (m *Error) MarshalVT() (dAtA []byte, err error)
- func (*Error) ProtoMessage()
- func (x *Error) ProtoReflect() protoreflect.Message
- func (x *Error) Reset()
- func (m *Error) SizeVT() (n int)
- func (x *Error) String() string
- func (m *Error) UnmarshalVT(dAtA []byte) error
- type ErrorCode
- type ErrorContext
- func (*ErrorContext) Descriptor() ([]byte, []int)deprecated
- func (x *ErrorContext) GetKey() string
- func (x *ErrorContext) GetValue() string
- func (m *ErrorContext) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *ErrorContext) MarshalToVT(dAtA []byte) (int, error)
- func (m *ErrorContext) MarshalVT() (dAtA []byte, err error)
- func (*ErrorContext) ProtoMessage()
- func (x *ErrorContext) ProtoReflect() protoreflect.Message
- func (x *ErrorContext) Reset()
- func (m *ErrorContext) SizeVT() (n int)
- func (x *ErrorContext) String() string
- func (m *ErrorContext) UnmarshalVT(dAtA []byte) error
- type KeyRange
- type ListPaginatedProtobufResult
- type ListPaginatedStringResult
- type ListPaginatedUint32Result
- type ListPaginatedUint64Result
- type OneToManySortedIndex
- func (i *OneToManySortedIndex) Add(txn *store.Txn, pk []byte, item []byte) error
- func (i *OneToManySortedIndex) Delete(txn *store.Txn, pk []byte, item []byte) error
- func (t *OneToManySortedIndex) GetTableKeyRange() KeyRange
- func (i *OneToManySortedIndex) ListAll(txn *store.Txn, pk []byte, fn func(item []byte) (bool, error)) error
- func (i *OneToManySortedIndex) ListInRange(txn *store.Txn, pk []byte, lowerBound []byte, upperBound []byte, ...) error
- type OneToManyUint64Index
- func (i *OneToManyUint64Index) Add(txn *store.Txn, pk []byte, item uint64) error
- func (i *OneToManyUint64Index) Delete(txn *store.Txn, pk []byte, item uint64) error
- func (t *OneToManyUint64Index) GetTableKeyRange() KeyRange
- func (i *OneToManyUint64Index) List(txn *store.Txn, pk []byte, fn func(item uint64) (bool, error)) error
- func (i *OneToManyUint64Index) NotEmpty(txn *store.Txn, pk []byte) (bool, error)
- type PaginationToken
- type Response
- func (*Response) Descriptor() ([]byte, []int)deprecated
- func (x *Response) GetData() []byte
- func (x *Response) GetError() *Error
- func (m *Response) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Response) MarshalToVT(dAtA []byte) (int, error)
- func (m *Response) MarshalVT() (dAtA []byte, err error)
- func (*Response) ProtoMessage()
- func (x *Response) ProtoReflect() protoreflect.Message
- func (x *Response) Reset()
- func (m *Response) SizeVT() (n int)
- func (x *Response) String() string
- func (m *Response) UnmarshalVT(dAtA []byte) error
- type SortedIndex
- type StringTable
- func (t *StringTable) Delete(txn *store.Txn, key []byte) error
- func (t *StringTable) Get(txn *store.Txn, key []byte) (string, error)
- func (t *StringTable) GetTableKeyRange() KeyRange
- func (t *StringTable) ListAll(txn *store.Txn, prefix []byte) ([]string, error)
- func (t *StringTable) ListInRange(txn *store.Txn, lowerBound []byte, upperBound []byte, reverse bool, ...) error
- func (t *StringTable) ListPaginated(txn *store.Txn, prefix []byte, paginationToken *PaginationToken, limit int) (*ListPaginatedStringResult, error)
- func (t *StringTable) Set(txn *store.Txn, key []byte, value string) error
- type Uint32Table
- func (t *Uint32Table) Delete(txn *store.Txn, key []byte) error
- func (t *Uint32Table) Get(txn *store.Txn, key []byte) (uint32, error)
- func (t *Uint32Table) GetTableKeyRange() KeyRange
- func (t *Uint32Table) ListAll(txn *store.Txn, prefix []byte) ([]uint32, error)
- func (t *Uint32Table) ListPaginated(txn *store.Txn, prefix []byte, paginationToken *PaginationToken, limit int) (*ListPaginatedUint32Result, error)
- func (t *Uint32Table) Set(txn *store.Txn, key []byte, value uint32) error
- type Uint64Table
- func (t *Uint64Table) Delete(txn *store.Txn, key []byte) error
- func (t *Uint64Table) Get(txn *store.Txn, key []byte) (uint64, error)
- func (t *Uint64Table) GetTableKeyRange() KeyRange
- func (t *Uint64Table) ListAll(txn *store.Txn, prefix []byte) ([]uint64, error)
- func (t *Uint64Table) ListPaginated(txn *store.Txn, prefix []byte, paginationToken *PaginationToken, limit int) (*ListPaginatedUint64Result, error)
- func (t *Uint64Table) Set(txn *store.Txn, key []byte, value uint64) error
Constants ¶
const ( OK = ErrorCode_OK InvalidArgument = ErrorCode_INVALID_ARGUMENT DeadlineExceeded = ErrorCode_DEADLINE_EXCEEDED NotFound = ErrorCode_NOT_FOUND AlreadyExists = ErrorCode_ALREADY_EXISTS ResourceExhausted = ErrorCode_RESOURCE_EXHAUSTED Unimplemented = ErrorCode_UNIMPLEMENTED Internal = ErrorCode_INTERNAL )
Variables ¶
var ( ErrorCode_name = map[int32]string{ 0: "INVALID", 1: "OK", 2: "INVALID_ARGUMENT", 3: "DEADLINE_EXCEEDED", 4: "NOT_FOUND", 5: "ALREADY_EXISTS", 6: "RESOURCE_EXHAUSTED", 7: "UNIMPLEMENTED", 8: "INTERNAL", } ErrorCode_value = map[string]int32{ "INVALID": 0, "OK": 1, "INVALID_ARGUMENT": 2, "DEADLINE_EXCEEDED": 3, "NOT_FOUND": 4, "ALREADY_EXISTS": 5, "RESOURCE_EXHAUSTED": 6, "UNIMPLEMENTED": 7, "INTERNAL": 8, } )
Enum value maps for ErrorCode.
var File_x_response_proto protoreflect.FileDescriptor
Functions ¶
func ErrorToGRPC ¶
func MeasureSince ¶
func MeasureSince(o prometheus.Observer, t1 time.Time)
func Restore ¶
func Restore(s *store.BadgerStore, ranges []KeyRange, reader io.ReadCloser) error
func WriteProtoMessageIntoStream ¶
func WriteProtoMessageIntoStream(w io.Writer, msg encoding.BinaryMarshaler) error
Types ¶
type BadgerStoreSnapshot ¶
type BadgerStoreSnapshot struct {
// contains filtered or unexported fields
}
func Snapshot ¶
func Snapshot(s *store.BadgerStore, ranges []KeyRange) BadgerStoreSnapshot
func (BadgerStoreSnapshot) Release ¶
func (s BadgerStoreSnapshot) Release()
type BinaryTable ¶
type BinaryTable[T ptr[U], U any] struct { // contains filtered or unexported fields }
BinaryTable is table with a composite key: primary key PK and secondary key SK and generic values (of encoding.BinaryMarshaler type). Get, Set, Delete operations use PK+SK to refer records. List operation uses PK as a prefix.
func NewBinaryTable ¶
func NewBinaryTable[T ptr[U], U any](tableId []byte, keyLowerBound []byte, keyUpperBound []byte) *BinaryTable[T, U]
func (*BinaryTable[T, U]) Delete ¶
func (t *BinaryTable[T, U]) Delete(txn *store.Txn, key []byte) error
func (*BinaryTable[T, U]) Get ¶
func (t *BinaryTable[T, U]) Get(txn *store.Txn, key []byte) (T, error)
func (*BinaryTable) GetTableKeyRange ¶
func (t *BinaryTable) GetTableKeyRange() KeyRange
func (*BinaryTable[T, U]) ListAll ¶
func (t *BinaryTable[T, U]) ListAll(txn *store.Txn, prefix []byte) ([]T, error)
func (*BinaryTable[T, U]) ListInRange ¶
func (*BinaryTable[T, U]) ListPaginated ¶
func (t *BinaryTable[T, U]) ListPaginated(txn *store.Txn, prefix []byte, paginationToken *PaginationToken, limit int) (*ListPaginatedProtobufResult[T, U], error)
type Error ¶
type Error struct {
Code ErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=com.evrblk.monstera.monsterax.ErrorCode" json:"code,omitempty"`
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
Context []*ErrorContext `protobuf:"bytes,3,rep,name=context,proto3" json:"context,omitempty"`
// contains filtered or unexported fields
}
func NewErrorWithContext ¶
func (*Error) Descriptor
deprecated
func (*Error) GetContext ¶
func (x *Error) GetContext() []*ErrorContext
func (*Error) GetMessage ¶
func (*Error) MarshalToSizedBufferVT ¶
func (*Error) ProtoMessage ¶
func (*Error) ProtoMessage()
func (*Error) ProtoReflect ¶
func (x *Error) ProtoReflect() protoreflect.Message
func (*Error) UnmarshalVT ¶
type ErrorCode ¶
type ErrorCode int32
const ( ErrorCode_INVALID ErrorCode = 0 ErrorCode_OK ErrorCode = 1 ErrorCode_INVALID_ARGUMENT ErrorCode = 2 ErrorCode_DEADLINE_EXCEEDED ErrorCode = 3 ErrorCode_NOT_FOUND ErrorCode = 4 ErrorCode_ALREADY_EXISTS ErrorCode = 5 ErrorCode_RESOURCE_EXHAUSTED ErrorCode = 6 ErrorCode_UNIMPLEMENTED ErrorCode = 7 ErrorCode_INTERNAL ErrorCode = 8 )
func (ErrorCode) Descriptor ¶
func (ErrorCode) Descriptor() protoreflect.EnumDescriptor
func (ErrorCode) EnumDescriptor
deprecated
func (ErrorCode) Number ¶
func (x ErrorCode) Number() protoreflect.EnumNumber
func (ErrorCode) Type ¶
func (ErrorCode) Type() protoreflect.EnumType
type ErrorContext ¶
type ErrorContext struct {
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
// contains filtered or unexported fields
}
func (*ErrorContext) Descriptor
deprecated
func (*ErrorContext) Descriptor() ([]byte, []int)
Deprecated: Use ErrorContext.ProtoReflect.Descriptor instead.
func (*ErrorContext) GetKey ¶
func (x *ErrorContext) GetKey() string
func (*ErrorContext) GetValue ¶
func (x *ErrorContext) GetValue() string
func (*ErrorContext) MarshalToSizedBufferVT ¶
func (m *ErrorContext) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*ErrorContext) MarshalToVT ¶
func (m *ErrorContext) MarshalToVT(dAtA []byte) (int, error)
func (*ErrorContext) MarshalVT ¶
func (m *ErrorContext) MarshalVT() (dAtA []byte, err error)
func (*ErrorContext) ProtoMessage ¶
func (*ErrorContext) ProtoMessage()
func (*ErrorContext) ProtoReflect ¶
func (x *ErrorContext) ProtoReflect() protoreflect.Message
func (*ErrorContext) Reset ¶
func (x *ErrorContext) Reset()
func (*ErrorContext) SizeVT ¶
func (m *ErrorContext) SizeVT() (n int)
func (*ErrorContext) String ¶
func (x *ErrorContext) String() string
func (*ErrorContext) UnmarshalVT ¶
func (m *ErrorContext) UnmarshalVT(dAtA []byte) error
type ListPaginatedProtobufResult ¶
type ListPaginatedProtobufResult[T ptr[U], U any] struct { Items []T NextPaginationToken *PaginationToken PreviousPaginationToken *PaginationToken }
type ListPaginatedStringResult ¶
type ListPaginatedStringResult struct {
Items []string
NextPaginationToken *PaginationToken
PreviousPaginationToken *PaginationToken
}
type ListPaginatedUint32Result ¶
type ListPaginatedUint32Result struct {
Items []uint32
NextPaginationToken *PaginationToken
PreviousPaginationToken *PaginationToken
}
type ListPaginatedUint64Result ¶
type ListPaginatedUint64Result struct {
Items []uint64
NextPaginationToken *PaginationToken
PreviousPaginationToken *PaginationToken
}
type OneToManySortedIndex ¶
type OneToManySortedIndex struct {
// contains filtered or unexported fields
}
OneToManySortedIndex stores multiple items (arbitrary []byte) per single key PK (arbitrary []byte).
func NewOneToManySortedIndex ¶
func NewOneToManySortedIndex(tableId []byte, keyLowerBound []byte, keyUpperBound []byte) *OneToManySortedIndex
func (*OneToManySortedIndex) GetTableKeyRange ¶
func (t *OneToManySortedIndex) GetTableKeyRange() KeyRange
type OneToManyUint64Index ¶
type OneToManyUint64Index struct {
// contains filtered or unexported fields
}
OneToManyUint64Index stores multiple items (uint64) per single key PK (arbitrary []byte).
func NewOneToManyUint64Index ¶
func NewOneToManyUint64Index(tableId []byte, keyLowerBound []byte, keyUpperBound []byte) *OneToManyUint64Index
func (*OneToManyUint64Index) GetTableKeyRange ¶
func (t *OneToManyUint64Index) GetTableKeyRange() KeyRange
type PaginationToken ¶
type Response ¶
type Response struct {
Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
Error *Error `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
// contains filtered or unexported fields
}
func (*Response) Descriptor
deprecated
func (*Response) MarshalToSizedBufferVT ¶
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
func (*Response) ProtoReflect ¶
func (x *Response) ProtoReflect() protoreflect.Message
func (*Response) UnmarshalVT ¶
type SortedIndex ¶
type SortedIndex struct {
// contains filtered or unexported fields
}
SortedIndex stores multiple sorted items (arbitrary []byte) without any PK (global index)
func NewSortedIndex ¶
func NewSortedIndex(tableId []byte, keyLowerBound []byte, keyUpperBound []byte) *SortedIndex
func (*SortedIndex) GetTableKeyRange ¶
func (i *SortedIndex) GetTableKeyRange() KeyRange
type StringTable ¶
type StringTable struct {
// contains filtered or unexported fields
}
StringTable is table with a composite key: primary key PK and secondary key SK and string values. Get, Set, Delete operations use PK+SK to refer records. List operation uses PK as a prefix.
func NewStringTable ¶
func NewStringTable(tableId []byte, keyLowerBound []byte, keyUpperBound []byte) *StringTable
func (*StringTable) GetTableKeyRange ¶
func (t *StringTable) GetTableKeyRange() KeyRange
func (*StringTable) ListInRange ¶
func (*StringTable) ListPaginated ¶
func (t *StringTable) ListPaginated(txn *store.Txn, prefix []byte, paginationToken *PaginationToken, limit int) (*ListPaginatedStringResult, error)
type Uint32Table ¶
type Uint32Table struct {
// contains filtered or unexported fields
}
Uint32Table is table with a composite key: primary key PK and secondary key SK and uint32 values. Get, Set, Delete operations use PK+SK to refer records. List operation uses PK as a prefix.
func NewUint32Table ¶
func NewUint32Table(tableId []byte, keyLowerBound []byte, keyUpperBound []byte) *Uint32Table
func (*Uint32Table) GetTableKeyRange ¶
func (t *Uint32Table) GetTableKeyRange() KeyRange
func (*Uint32Table) ListPaginated ¶
func (t *Uint32Table) ListPaginated(txn *store.Txn, prefix []byte, paginationToken *PaginationToken, limit int) (*ListPaginatedUint32Result, error)
type Uint64Table ¶
type Uint64Table struct {
// contains filtered or unexported fields
}
Uint64Table is table with a composite key: primary key PK and secondary key SK and uint64 values. Get, Set, Delete operations use PK+SK to refer records. List operation uses PK as a prefix.
func NewUint64Table ¶
func NewUint64Table(tableId []byte, keyLowerBound []byte, keyUpperBound []byte) *Uint64Table
func (*Uint64Table) GetTableKeyRange ¶
func (t *Uint64Table) GetTableKeyRange() KeyRange
func (*Uint64Table) ListPaginated ¶
func (t *Uint64Table) ListPaginated(txn *store.Txn, prefix []byte, paginationToken *PaginationToken, limit int) (*ListPaginatedUint64Result, error)