tiledb package - github.com/TileDB-Inc/TileDB-Go - Go Packages (original) (raw)
Package tiledb is an idiomatic Go binding to tiledb's c_api. Go structs are used for object-style access to tiledb types, such as `Config` and `ArraySchema`. Tiledb C objects that are alloc'ed are set to be freeded on garbage collection using `runtime.SetFinalizer`.
For more information on TileDB see the official docs athttps://docs.tiledb.io/en/stable .
Semantic versioning is followed for this package and for compatibility with Go modules. See the compatibility section of README.md for a mapping of TileDB-Go package to tiledb core library versions,https://github.com/TileDB-Inc/TileDB-Go/blob/master/README.md#compatibility .
Installation ¶
See README.md for installation requirements and instructions:https://github.com/TileDB-Inc/TileDB-Go/blob/master/README.md#installation .
Quickstart ¶
See `quickstart_dense_test.go` and `quickstart_sparse_test.go` for examples. Also check out the official tiledb quickstart docs athttps://docs.tiledb.io/en/latest/quickstart.html
func ConsolidateArray(tdbCtx *Context, uri string, config *Config) error
func CreateArray(tdbCtx *Context, uri string, arraySchema *ArraySchema) error
func CreateFile(tdbCtx *Context, arrayURI string, data []byte, mimeType FileStoreMimeType) error
func DeleteFragments(tdbCtx *Context, uri string, startTimestamp, endTimestamp uint64) error
func DeleteFragmentsList(tdbCtx *Context, uri string, fragmentURIs []string) error
func DeserializeArrayMetadata(a *Array, buffer *Buffer, serializationType SerializationType) error
func DeserializeFragmentInfo(fragmentInfo FragmentInfo, buffer *Buffer, arrayURI string, ...) error
func DeserializeGroupMetadata(g *Group, buffer *Buffer, serializationType SerializationType) error
func DeserializeQuery(query *Query, buffer *Buffer, serializationType SerializationType, ...) error
func ExportFile(tdbCtx *Context, filePath, arrayURI string) error
func FileSize(tdbCtx *Context, arrayURI string) (int64, error)
func GetTimeFromTimestamp(datatype Datatype, timestamp int64) time.Time
func ImportFile(tdbCtx *Context, arrayURI, filePath string, mimeType FileStoreMimeType) error
func ObjectMove(tdbCtx *Context, path string, newPath string) error
func SerializeArrayMetadata(a *Array, serializationType SerializationType) ([]byte, error)deprecated
func SerializeArrayNonEmptyDomain(a *Array, serializationType SerializationType) ([]byte, error)deprecated
func SerializeArraySchemaEvolution(arraySchemaEvolution *ArraySchemaEvolution, ...) ([]byte, error)deprecated
func SerializeGroupMetadata(g *Group, serializationType SerializationType) ([]byte, error)deprecated
func VacuumArray(tdbCtx *Context, uri string, config *Config) error
- func (a *Array) Close() error
- func (a *Array) Config() (*Config, error)
- func (a *Array) Consolidate(config *Config) error
- func (a *Array) ConsolidateFragments(config *Config, fragmentList []string) error
- func (a *Array) Context() *Context
- func (a *Array) Create(arraySchema *ArraySchema) error
- func (a *Array) DeleteMetadata(key string) error
- func (a *Array) Free()
- func (a *Array) GetEnumeration(name string) (*Enumeration, error)
- func (a *Array) GetMetadata(key string) (Datatype, uint, interface{}, error)
- func (a *Array) GetMetadataFromIndex(index uint64) (*ArrayMetadata, error)
- func (a *Array) GetMetadataFromIndexWithValueLimit(index uint64, limit *uint) (*ArrayMetadata, error)
- func (a *Array) GetMetadataMap() (map[string]*ArrayMetadata, error)
- func (a *Array) GetMetadataMapWithValueLimit(limit *uint) (map[string]*ArrayMetadata, error)
- func (a *Array) GetMetadataNum() (uint64, error)
- func (a Array) GetNonEmptyDomainSliceFromIndex(dimIdx uint) (*Dimension, interface{}, unsafe.Pointer, error)
- func (a Array) GetNonEmptyDomainSliceFromName(dimName string) (*Dimension, interface{}, unsafe.Pointer, error)
- func (a *Array) LoadAllEnumerations() error
- func (a *Array) LoadEnumerationsAllSchemas() error
- func (a *Array) NewSubarray() (*Subarray, error)
- func (a *Array) NonEmptyDomain() ([]NonEmptyDomain, bool, error)
- func (a *Array) NonEmptyDomainFromIndex(dimIdx uint) (*NonEmptyDomain, bool, error)
- func (a *Array) NonEmptyDomainFromName(dimName string) (*NonEmptyDomain, bool, error)
- func (a *Array) NonEmptyDomainMap() (map[string]interface{}, error)
- func (a *Array) NonEmptyDomainVarFromIndex(dimIdx uint) (*NonEmptyDomain, bool, error)
- func (a *Array) NonEmptyDomainVarFromName(dimName string) (*NonEmptyDomain, bool, error)
- func (a *Array) Open(queryType QueryType) error
- func (a *Array) OpenEndTime() (time.Time, error)
- func (a *Array) OpenEndTimestamp() (uint64, error)
- func (a *Array) OpenStartTime() (time.Time, error)
- func (a *Array) OpenStartTimestamp() (uint64, error)
- func (a *Array) OpenWithOptions(queryType QueryType, opts ...ArrayOpenOption) error
- func (a *Array) PutCharMetadata(key string, charData string) error
- func (a *Array) PutMetadata(key string, value interface{}) error
- func (a *Array) QueryType() (QueryType, error)
- func (a *Array) Reopen() error
- func (a *Array) Schema() (*ArraySchema, error)
- func (a *Array) SetConfig(config *Config) error
- func (a *Array) URI() (string, error)
- func (a *Array) Vacuum(config *Config) error
- func DeserializeArrayCreate(buffer *Buffer, serializationType SerializationType, clientSide bool) (*ArraySchema, string, error)
- func DeserializeArraySchema(buffer *Buffer, serializationType SerializationType, clientSide bool) (*ArraySchema, error)
- func LoadArraySchema(context *Context, path string) (*ArraySchema, error)
- func NewArraySchema(tdbCtx *Context, arrayType ArrayType) (*ArraySchema, error)
- func NewArraySchemaForFile(tdbCtx *Context, filePath string) (*ArraySchema, error)
- func (a *ArraySchema) AddAttributes(attributes ...*Attribute) error
- func (a *ArraySchema) AddDimensionLabel(dimIndex uint32, name string, order DataOrder, labelType Datatype) error
- func (a *ArraySchema) AddEnumeration(e *Enumeration) error
- func (a *ArraySchema) AllowsDups() (bool, error)
- func (a *ArraySchema) AttributeFromIndex(index uint) (*Attribute, error)
- func (a *ArraySchema) AttributeFromName(attrName string) (*Attribute, error)
- func (a *ArraySchema) AttributeNum() (uint, error)
- func (a *ArraySchema) Attributes() ([]*Attribute, error)
- func (a *ArraySchema) Capacity() (uint64, error)
- func (a *ArraySchema) CellOrder() (Layout, error)
- func (a *ArraySchema) Check() error
- func (a *ArraySchema) Context() *Context
- func (a *ArraySchema) CoordsFilterList() (*FilterList, error)
- func (a *ArraySchema) DimensionLabelFromIndex(labelIdx uint64) (*DimensionLabel, error)
- func (a *ArraySchema) DimensionLabelFromName(name string) (*DimensionLabel, error)
- func (a *ArraySchema) DimensionLabelsNum() (uint64, error)
- func (a *ArraySchema) Domain() (*Domain, error)
- func (a *ArraySchema) Dump(path string) error
- func (a *ArraySchema) DumpSTDOUT() error
- func (a *ArraySchema) DumpToString() (string, error)
- func (a *ArraySchema) EnumerationFromAttributeName(name string) (*Enumeration, error)
- func (a *ArraySchema) EnumerationFromName(name string) (*Enumeration, error)
- func (a *ArraySchema) Free()
- func (a *ArraySchema) HasAttribute(attrName string) (bool, error)
- func (a *ArraySchema) HasDimensionLabel(name string) (bool, error)
- func (a *ArraySchema) MarshalJSON() ([]byte, error)
- func (a *ArraySchema) OffsetsFilterList() (*FilterList, error)
- func (a *ArraySchema) SetAllowsDups(allowsDups bool) error
- func (a *ArraySchema) SetCapacity(capacity uint64) error
- func (a *ArraySchema) SetCellOrder(cellOrder Layout) error
- func (a *ArraySchema) SetCoordsFilterList(filterList *FilterList) error
- func (a *ArraySchema) SetDimensionLabelFilterList(name string, filterList FilterList) error
- func (a *ArraySchema) SetDimensionLabelTileExtent(labelName string, dimType Datatype, extent interface{}) error
- func (a *ArraySchema) SetDomain(domain *Domain) error
- func (a *ArraySchema) SetOffsetsFilterList(filterList *FilterList) error
- func (a *ArraySchema) SetTileOrder(tileOrder Layout) error
- func (a *ArraySchema) TileOrder() (Layout, error)
- func (a *ArraySchema) TimestampRange() (uint64, uint64, error)
- func (a *ArraySchema) Type() (ArrayType, error)
- func (a *ArraySchema) UnmarshalJSON(b []byte) error
- func (ase *ArraySchemaEvolution) AddAttribute(attribute *Attribute) error
- func (ase *ArraySchemaEvolution) AddEnumeration(e *Enumeration) error
- func (ase *ArraySchemaEvolution) ApplyExtendedEnumeration(e *Enumeration) error
- func (ase *ArraySchemaEvolution) Context() *Context
- func (ase *ArraySchemaEvolution) DropAttribute(name string) error
- func (ase *ArraySchemaEvolution) DropEnumeration(name string) error
- func (ase *ArraySchemaEvolution) Evolve(uri string) error
- func (ase *ArraySchemaEvolution) Free()
- func (a *Attribute) CellSize() (uint64, error)
- func (a *Attribute) CellValNum() (uint32, error)
- func (a *Attribute) Context() *Context
- func (a *Attribute) Dump(path string) error
- func (a *Attribute) DumpSTDOUT() error
- func (a *Attribute) DumpToString() (string, error)
- func (a *Attribute) FilterList() (*FilterList, error)
- func (a *Attribute) Free()
- func (a *Attribute) GetEnumerationName() (string, error)
- func (a *Attribute) GetFillValue() (interface{}, uint64, error)
- func (a *Attribute) GetFillValueNullable() (interface{}, uint64, bool, error)
- func (a *Attribute) Name() (string, error)
- func (a *Attribute) Nullable() (bool, error)
- func (a *Attribute) SetCellValNum(val uint32) error
- func (a *Attribute) SetEnumerationName(name string) error
- func (a *Attribute) SetFillValue(value interface{}) error
- func (a *Attribute) SetFillValueNullable(value interface{}, valid bool) error
- func (a *Attribute) SetFilterList(filterlist *FilterList) error
- func (a *Attribute) SetNullable(nullable bool) error
- func (a *Attribute) Type() (Datatype, error)
- func DeserializeLoadEnumerationsRequest(array *Array, serializationType SerializationType, request *Buffer) (*Buffer, error)
- func HandleConsolidationPlanRequest(array *Array, serializationType SerializationType, request *Buffer) (*Buffer, error)
- func HandleLoadArraySchemaRequest(array *Array, request *Buffer, serializationType SerializationType) (*Buffer, error)
- func HandleQueryPlanRequest(array *Array, serializationType SerializationType, request *Buffer) (*Buffer, error)
- func NewBuffer(context *Context) (*Buffer, error)
- func SerializeArrayMetadataToBuffer(a *Array, serializationType SerializationType) (*Buffer, error)
- func SerializeArrayNonEmptyDomainAllDimensionsToBuffer(a *Array, serializationType SerializationType) (*Buffer, error)
- func SerializeArrayNonEmptyDomainToBuffer(a *Array, serializationType SerializationType) (*Buffer, error)
- func SerializeArraySchemaEvolutionToBuffer(arraySchemaEvolution *ArraySchemaEvolution, ...) (*Buffer, error)
- func SerializeArraySchemaToBuffer(schema *ArraySchema, serializationType SerializationType, clientSide bool) (*Buffer, error)
- func SerializeArrayToBuffer(array *Array, serializationType SerializationType, clientSide bool) (*Buffer, error)
- func SerializeFragmentInfoRequestToBuffer(fragmentInfo *FragmentInfo, serializationType SerializationType, ...) (*Buffer, error)
- func SerializeFragmentInfoToBuffer(fragmentInfo *FragmentInfo, serializationType SerializationType, ...) (*Buffer, error)
- func SerializeGroupMetadataToBuffer(g *Group, serializationType SerializationType) (*Buffer, error)
- func SerializeQueryEstResultSizesToBuffer(q *Query, serializationType SerializationType, clientSide bool) (*Buffer, error)
- func (b *Buffer) Context() *Context
- func (b *Buffer) Free()
- func (b *Buffer) Len() (uint64, error)
- func (b *Buffer) ReadAt(p []byte, off int64) (int, error)
- func (b *Buffer) Serialize(serializationType SerializationType) ([]byte, error)deprecated
- func (b *Buffer) SetBuffer(buffer []byte) error
- func (b *Buffer) SetType(datatype Datatype) error
- func (b *Buffer) Type() (Datatype, error)
- func (b *Buffer) WriteTo(w io.Writer) (int64, error)
- func (b *BufferList) Context() *Context
- func (b *BufferList) Flatten() (*Buffer, error)deprecated
- func (b *BufferList) Free()
- func (b *BufferList) GetBuffer(bufferIndex uint) (*Buffer, error)
- func (b *BufferList) NumBuffers() (uint64, error)
- func (b *BufferList) TotalSize() (uint64, error)
- func (b *BufferList) WriteTo(w io.Writer) (int64, error)
- func (c *Config) Cmp(other *Config) bool
- func (c *Config) Free()
- func (c *Config) Get(param string) (string, error)
- func (c *Config) Iterate(prefix string) (*ConfigIter, error)
- func (c *Config) SaveToFile(file string) error
- func (c *Config) Set(param string, value string) error
- func (c *Config) Unset(param string) error
- func (cp *ConsolidationPlan) DumpJSON() (string, error)
- func (cp *ConsolidationPlan) FragmentURI(nodeIndex, fragmentIndex uint64) (string, error)
- func (cp *ConsolidationPlan) Free()
- func (cp *ConsolidationPlan) NumFragments(nodeIndex uint64) (uint64, error)
- func (cp *ConsolidationPlan) NumNodes() (uint64, error)
- func (c *Context) CancelAllTasks() error
- func (c *Context) Config() (*Config, error)
- func (c *Context) DataProtocol(uri string) (DataProtocol, error)
- func (c *Context) Free()
- func (c *Context) IsSupportedFS(fs FS) (bool, error)
- func (c *Context) LastError() error
- func (c *Context) SetTag(key string, value string) error
- func (c *Context) Stats() ([]byte, error)
- func (d *Datatype) FromString(s string) error
- func (d Datatype) GetValue(valueNum uint, cvalue unsafe.Pointer) (interface{}, error)
- func (d Datatype) MakeSlice(numElements uint64) (interface{}, unsafe.Pointer, error)
- func (d Datatype) MarshalJSON() ([]byte, error)
- func (d Datatype) ReflectKind() reflect.Kind
- func (d Datatype) ReflectType() reflect.Type
- func (d Datatype) Size() uint64
- func (d Datatype) String() string
- func (d *Datatype) UnmarshalJSON(bytes []byte) error
- func (d *Dimension) CellValNum() (uint32, error)
- func (d *Dimension) Context() *Context
- func (d *Dimension) Domain() (interface{}, error)
- func (d *Dimension) Dump(path string) error
- func (d *Dimension) DumpSTDOUT() error
- func (d *Dimension) DumpToString() (string, error)
- func (d *Dimension) Extent() (interface{}, error)
- func (d *Dimension) FilterList() (*FilterList, error)
- func (d *Dimension) Free()
- func (d *Dimension) Name() (string, error)
- func (d *Dimension) SetCellValNum(val uint32) error
- func (d *Dimension) SetFilterList(filterlist *FilterList) error
- func (d *Dimension) Type() (Datatype, error)
- func (d *DimensionLabel) AttributeName() (string, error)
- func (d *DimensionLabel) CellValNum() (uint32, error)
- func (d *DimensionLabel) DimensionIndex() (uint32, error)
- func (d *DimensionLabel) Free()
- func (d *DimensionLabel) Name() (string, error)
- func (d *DimensionLabel) Order() (DataOrder, error)
- func (d *DimensionLabel) Type() (Datatype, error)
- func (d *DimensionLabel) URI() (string, error)
- func (d *Domain) AddDimensions(dimensions ...*Dimension) error
- func (d *Domain) Context() *Context
- func (d *Domain) DimensionFromIndex(index uint) (*Dimension, error)
- func (d *Domain) DimensionFromName(name string) (*Dimension, error)
- func (d *Domain) Dump(path string) error
- func (d *Domain) DumpSTDOUT() error
- func (d *Domain) DumpToString() (string, error)
- func (d *Domain) Free()
- func (d *Domain) HasDimension(dimName string) (bool, error)
- func (d *Domain) NDim() (uint, error)
- func (d *Domain) Type() (Datatype, error)
- func ExtendEnumeration[T EnumerationType](tdbCtx *Context, e *Enumeration, values []T) (*Enumeration, error)
- func NewOrderedEnumeration[T EnumerationType](tdbCtx *Context, name string, values []T) (*Enumeration, error)
- func NewUnorderedEnumeration[T EnumerationType](tdbCtx *Context, name string, values []T) (*Enumeration, error)
- func (e *Enumeration) CellValNum() (uint32, error)
- func (e *Enumeration) Dump(path string) error
- func (e *Enumeration) DumpSTDOUT() error
- func (e *Enumeration) DumpToString() (string, error)
- func (e *Enumeration) Free()
- func (e *Enumeration) IsOrdered() (bool, error)
- func (e *Enumeration) Name() (string, error)
- func (e *Enumeration) Type() (Datatype, error)
- func (e *Enumeration) Values() (interface{}, error)
- func (f *FilterList) AddFilter(filter *Filter) error
- func (f *FilterList) Context() *Context
- func (f *FilterList) FilterFromIndex(index uint32) (*Filter, error)
- func (f *FilterList) Filters() ([]*Filter, error)
- func (f *FilterList) Free()
- func (f *FilterList) MaxChunkSize() (uint32, error)
- func (f *FilterList) NFilters() (uint32, error)
- func (f *FilterList) SetMaxChunkSize(maxChunkSize uint32) error
- func (fI *FragmentInfo) Config() (*Config, error)
- func (fI *FragmentInfo) Context() *Context
- func (fI *FragmentInfo) DumpSTDOUT() error
- func (fI *FragmentInfo) Free()
- func (fI *FragmentInfo) GetCellNum(fid uint32) (uint64, error)
- func (fI *FragmentInfo) GetDense(fid uint32) (bool, error)
- func (fI *FragmentInfo) GetFragmentNum() (uint32, error)
- func (fI *FragmentInfo) GetFragmentSize(fid uint32) (uint64, error)
- func (fI *FragmentInfo) GetFragmentURI(fid uint32) (string, error)
- func (fI *FragmentInfo) GetNonEmptyDomainFromIndex(fid uint32, did uint32) (*NonEmptyDomain, error)
- func (fI *FragmentInfo) GetNonEmptyDomainFromName(fid uint32, did string) (*NonEmptyDomain, error)
- func (fI *FragmentInfo) GetNonEmptyDomainVarFromIndex(fid uint32, did uint32) (*NonEmptyDomain, error)
- func (fI *FragmentInfo) GetNonEmptyDomainVarFromName(fid uint32, did string) (*NonEmptyDomain, error)
- func (fI *FragmentInfo) GetNonEmptyDomainVarSizeFromIndex(fid uint32, did uint32) (uint64, uint64, error)
- func (fI *FragmentInfo) GetNonEmptyDomainVarSizeFromName(fid uint32, did string) (uint64, uint64, error)
- func (fI *FragmentInfo) GetSparse(fid uint32) (bool, error)
- func (fI *FragmentInfo) GetTimestampRange(fid uint32) (uint64, uint64, error)
- func (fI *FragmentInfo) GetToVacuumNum() (uint32, error)
- func (fI *FragmentInfo) GetToVacuumURI(fid uint32) (string, error)
- func (fI *FragmentInfo) GetUnconsolidatedMetadataNum() (uint32, error)
- func (fI *FragmentInfo) GetVersion(fid uint32) (uint32, error)
- func (fI *FragmentInfo) HasConsolidatedMetadata(fid uint32) (bool, error)
- func (fI *FragmentInfo) Load() error
- func (fI *FragmentInfo) SetConfig(config *Config) error
- func (fI *FragmentInfo) String() (string, error)
- func (g *Group) AddMember(uri, name string, isRelativeURI bool) error
- func (g *Group) AddMemberWithType(uri, name string, isRelativeURI bool, objectType ObjectTypeEnum) error
- func (g *Group) Close() error
- func (g *Group) Config() (*Config, error)
- func (g *Group) Context() *Context
- func (g *Group) Create() error
- func (g *Group) Delete(recursive bool) error
- func (g *Group) DeleteMetadata(key string) error
- func (g *Group) Deserialize(buffer *Buffer, serializationType SerializationType, clientSide bool) error
- func (g *Group) Dump(recurse bool) (string, error)
- func (g *Group) Free()
- func (g *Group) GetIsRelativeURIByName(name string) (bool, error)
- func (g *Group) GetMemberByName(name string) (string, string, ObjectTypeEnum, error)
- func (g *Group) GetMemberCount() (uint64, error)
- func (g *Group) GetMemberFromIndex(index uint64) (string, string, ObjectTypeEnum, error)
- func (g *Group) GetMetadata(key string) (Datatype, uint, interface{}, error)
- func (g *Group) GetMetadataFromIndex(index uint64) (*GroupMetadata, error)
- func (g *Group) GetMetadataFromIndexWithValueLimit(index uint64, limit *uint) (*GroupMetadata, error)
- func (g *Group) GetMetadataMap() (map[string]*GroupMetadata, error)
- func (g *Group) GetMetadataMapWithValueLimit(limit *uint) (map[string]*GroupMetadata, error)
- func (g *Group) GetMetadataNum() (uint64, error)
- func (g *Group) IsOpen() (bool, error)
- func (g *Group) Open(queryType QueryType) error
- func (g *Group) PutMetadata(key string, value interface{}) error
- func (g *Group) QueryType() (QueryType, error)
- func (g *Group) RemoveMember(uri string) error
- func (g *Group) SetConfig(config *Config) error
- func (q *Query) Array() (*Array, error)
- func (q *Query) Config() (*Config, error)
- func (q *Query) Context() *Context
- func (q *Query) EstResultSize(attributeName string) (*uint64, error)
- func (q *Query) EstResultSizeNullable(attributeName string) (*uint64, *uint64, error)
- func (q *Query) EstResultSizeVar(attributeName string) (*uint64, *uint64, error)
- func (q *Query) EstResultSizeVarNullable(attributeName string) (*uint64, *uint64, *uint64, error)
- func (q *Query) EstimateBufferElements() (map[string][3]uint64, error)
- func (q *Query) Finalize() error
- func (q *Query) Free()
- func (q *Query) GetDataBuffer(attributeOrDimension string) (interface{}, error)
- func (q *Query) GetExpectedDataBufferLength(attributeOrDimension string) (uint64, error)
- func (q *Query) GetExpectedOffsetsBufferLength(attributeOrDimension string) (uint64, error)
- func (q *Query) GetExpectedValidityBufferLength(attributeOrDimension string) (uint64, error)
- func (q *Query) GetFragmentNum() (*uint32, error)
- func (q *Query) GetFragmentTimestampRange(num uint64) (*uint64, *uint64, error)
- func (q *Query) GetFragmentURI(num uint64) (*string, error)
- func (q *Query) GetOffsetsBuffer(attributeOrDimension string) ([]uint64, error)
- func (q *Query) GetPlan() (string, error)
- func (q *Query) GetRanges() (map[string][]RangeLimits, error)deprecated
- func (q *Query) GetSubarray() (*Subarray, error)
- func (q *Query) GetValidityBuffer(attributeOrDimension string) ([]uint8, error)
- func (q *Query) HasResults() (bool, error)
- func (q *Query) RelevantFragmentNum() (uint64, error)
- func (q *Query) ResultBufferElements() (map[string][3]uint64, error)
- func (q *Query) SetConfig(config *Config) error
- func (q *Query) SetDataBuffer(attributeOrDimension string, buffer interface{}) (*uint64, error)
- func (q *Query) SetDataBufferUnsafe(attribute string, buffer unsafe.Pointer, bufferSize uint64) (*uint64, error)
- func (q *Query) SetLayout(layout Layout) error
- func (q *Query) SetOffsetsBuffer(attributeOrDimension string, offset []uint64) (*uint64, error)
- func (q *Query) SetOffsetsBufferUnsafe(attribute string, offset unsafe.Pointer, offsetSize uint64) (*uint64, error)
- func (q *Query) SetQueryCondition(cond *QueryCondition) error
- func (q *Query) SetSubarray(sa *Subarray) error
- func (q *Query) SetValidityBuffer(attributeOrDimension string, buffer []uint8) (*uint64, error)
- func (q *Query) SetValidityBufferUnsafe(attribute string, buffer unsafe.Pointer, bufferSize uint64) (*uint64, error)
- func (q *Query) Stats() ([]byte, error)
- func (q *Query) Status() (QueryStatus, error)
- func (q *Query) StatusDetails() (QueryStatusDetails, error)
- func (q *Query) Submit() error
- func (q *Query) Type() (QueryType, error)
- func NewQueryCondition(tdbCtx *Context, attributeName string, op QueryConditionOp, value interface{}) (*QueryCondition, error)
- func NewQueryConditionCombination(tdbCtx *Context, left *QueryCondition, op QueryConditionCombinationOp, ...) (*QueryCondition, error)
- func NewQueryConditionNegated(tdbCtx *Context, qc *QueryCondition) (*QueryCondition, error)
- func (sa *Subarray) AddDimensionLabelRange(labelName string, r Range) error
- func (sa *Subarray) AddRange(dimIdx uint32, r Range) error
- func (sa *Subarray) AddRangeByName(dimName string, r Range) error
- func (sa *Subarray) Free()
- func (sa *Subarray) GetDimensionLabelRange(labelName string, rangeNum uint64) (Range, error)
- func (sa *Subarray) GetDimensionLabelRangeNum(labelName string) (uint64, error)
- func (sa *Subarray) GetRange(dimIdx uint32, rangeNum uint64) (Range, error)
- func (sa *Subarray) GetRangeFromName(dimName string, rangeNum uint64) (Range, error)
- func (sa *Subarray) GetRangeNum(dimIdx uint32) (uint64, error)
- func (sa *Subarray) GetRangeNumFromName(dimName string) (uint64, error)
- func (s *Subarray) GetRanges() (map[string][]Range, error)
- func (sa *Subarray) SetCoalesceRanges(b bool) error
- func (sa *Subarray) SetConfig(cfg *Config) error
- func (sa *Subarray) SetSubArray(subArray interface{}) error
- func (v *VFS) Close(fh *VFSfh) error
- func (v *VFS) Config() (*Config, error)
- func (v *VFS) Context() *Context
- func (v *VFS) CopyFile(oldURI string, newURI string) error
- func (v *VFS) CreateBucket(uri string) error
- func (v *VFS) CreateDir(uri string) error
- func (v *VFS) DirSize(uri string) (uint64, error)
- func (v *VFS) EmptyBucket(uri string) error
- func (v *VFS) FileSize(uri string) (uint64, error)
- func (v *VFS) Free()
- func (v *VFS) IsBucket(uri string) (bool, error)
- func (v *VFS) IsDir(uri string) (bool, error)
- func (v *VFS) IsEmptyBucket(uri string) (bool, error)
- func (v *VFS) IsFile(uri string) (bool, error)
- func (v *VFS) List(path string) ([]string, []string, error)
- func (v *VFS) MoveDir(oldURI string, newURI string) error
- func (v *VFS) MoveFile(oldURI string, newURI string) error
- func (v *VFS) NumOfFragmentsInPath(path string) (int, error)
- func (v *VFS) Open(uri string, mode VFSMode) (*VFSfh, error)
- func (v *VFS) Read(fh *VFSfh, offset uint64, nbytes uint64) ([]byte, error)
- func (v *VFS) RemoveBucket(uri string) error
- func (v *VFS) RemoveDir(uri string) error
- func (v *VFS) RemoveFile(uri string) error
- func (v *VFS) Sync(fh *VFSfh) error
- func (v *VFS) Touch(uri string) error
- func (v *VFS) VisitRecursive(path string, callback VisitRecursiveCallback) errordeprecated
- func (v *VFS) VisitRecursiveV2(path string, callback VisitRecursiveCallbackV2) error
- func (v *VFS) Write(fh *VFSfh, bytes []byte) error
- func (v *VFSfh) Close() error
- func (v *VFSfh) Context() *Context
- func (v *VFSfh) Free()
- func (v *VFSfh) IsClosed() (bool, error)
- func (v *VFSfh) Read(p []byte) (int, error)
- func (v *VFSfh) ReadAt(p []byte, off int64) (int, error)
- func (v *VFSfh) Seek(offset int64, whence int) (int64, error)
- func (v *VFSfh) Sync() error
- func (v *VFSfh) Write(bytes []byte) (int, error)
type VisitRecursiveCallbackdeprecated
Mime types for TileDB filestore. The store can autodetect mime types but these are provided if the user wants to enforce a type
TILEDB_COORDS A special name indicating the coordinates attribute.
TILEDB_VAR_NUM indicates variable sized attributes for cell values
ConsolidateArray consolidates the fragments of an array into a single fragment. You must first finalize all queries to the array before consolidation can begin (as consolidation temporarily acquires an exclusive lock on the array).
func CreateAndImportFile ¶ added in v0.27.1
CreateAndImportFile creates at arrayURI a TileDB array suitable to store the local file at filePath and imports the contents.
CreateArray creates a new TileDB array given a context, URI and schema.
CreateFile creates at arrayURI a TileDB array with the filestore schema and writes the data. The array is created even if data is empty.
CreateGroup creates a new TileDB group given a context and URI.
DeleteFragments deletes the range of fragments from startTimestamp to endTimestamp.
DeleteFragmentsList deletes the fragments of the list.
func DeserializeArrayMetadata(a *Array, buffer *Buffer, serializationType SerializationType) error
DeserializeArrayMetadata deserializes array metadata.
func DeserializeFragmentInfo(fragmentInfo FragmentInfo, buffer *Buffer, arrayURI string, serializationType SerializationType, clientSide bool) error
DeserializeFragmentInfo deserializes an existing fragment info from the given buffer.
func DeserializeFragmentInfoRequest(fragmentInfo FragmentInfo, buffer *Buffer, serializationType SerializationType, clientSide bool) error
DeserializeFragmentInfoRequest deserializes an existing fragment info from the given buffer.
func DeserializeGroupMetadata(g *Group, buffer *Buffer, serializationType SerializationType) error
DeserializeGroupMetadata deserializes group metadata
func DeserializeQuery(query *Query, buffer *Buffer, serializationType SerializationType, clientSide bool) error
DeserializeQuery deserializes a buffer into an existing query.
func DeserializeQueryEstResultSizes(q *Query, buffer *Buffer, serializationType SerializationType, clientSide bool) error
DeserializeQueryEstResultSizes deserializes query estimated result sizes.
ExportFile reads the contents of the array at arrayURI, which should have a filestore schema, and writes them to the local file at filePath. All the subdirectories of filePath must exist.
func ExtractRange[T DimensionType](r Range) ([]T, error)
ExtractRange extracts the endpoints of the range. It returns []T{start, end, stride}. The stride is not supported by TileDB core yet, so it gets the zero value of T.
Size returns the uncompressed size of the array at arrayURI, which should have a filestore schema.
GetTimeFromTimestamp returns a time.Time object for a time related TileDB datatype Datetimes in TileDB are deltas from unix epoch with a resolution of the specified time.
func HandleArrayDeleteFragmentsListRequest ¶ added in v0.24.0
func HandleArrayDeleteFragmentsListRequest(context *Context, array *Array, buffer *Buffer, serializationType SerializationType) error
HandleArrayDeleteFragmentsListRequest is used by TileDB cloud to handle DeleteFragmentsList with tiledb:// uris.
func HandleArrayDeleteFragmentsTimestampsRequest ¶ added in v0.24.0
func HandleArrayDeleteFragmentsTimestampsRequest(context *Context, array *Array, buffer *Buffer, serializationType SerializationType) error
HandleArrayDeleteFragmentsTimestampsRequest is used by TileDB cloud to handle DeleteFragments with tiledb:// uris.
func ImportFile(tdbCtx *Context, arrayURI, filePath string, mimeType FileStoreMimeType) error
ImportFile stores the contents of the local file at filePath to the array at arrayURI, which should have a filestore schema.
ObjectMove moves a TileDB resource (group, array, key-value). Param path is the new path to move to
ObjectRemove deletes a TileDB resource (group, array, key-value).
func SerializeArray(array *Array, serializationType SerializationType, clientSide bool) ([]byte, error)
SerializeArray serializes an array.
Deprecated: Use SerializeArrayToBuffer instead.
func SerializeArrayMetadata(a *Array, serializationType SerializationType) ([]byte, error)
SerializeArrayMetadata gets and serializes the array metadata.
Deprecated: Use SerializeArrayMetadataToBuffer instead.
func SerializeArrayNonEmptyDomain deprecated added in v0.6.0
func SerializeArrayNonEmptyDomain(a *Array, serializationType SerializationType) ([]byte, error)
SerializeArrayNonEmptyDomain gets and serializes the array nonempty domain.
Deprecated: Use SerializeArrayNonEmptyDomainToBuffer instead.
func SerializeArrayNonEmptyDomainAllDimensions deprecated added in v0.9.0
func SerializeArrayNonEmptyDomainAllDimensions(a *Array, serializationType SerializationType) ([]byte, error)
SerializeArrayNonEmptyDomainAllDimensions gets and serializes the array nonempty domain.
Deprecated: Use SerializeArrayNonEmptyDomainAllDimensionsToBuffer instead.
func SerializeArraySchema(schema *ArraySchema, serializationType SerializationType, clientSide bool) ([]byte, error)
SerializeArraySchema serializes an array schema.
Deprecated: Use SerializeArraySchemaToBuffer instead.
func SerializeArraySchemaEvolution(arraySchemaEvolution *ArraySchemaEvolution, serializationType SerializationType, clientSide bool) ([]byte, error)
SerializeArraySchemaEvolution serializes the given array schema evolution.
Deprecated: Use SerializeArraySchemaEvolutionToBuffer instead.
func SerializeFragmentInfo(fragmentInfo *FragmentInfo, serializationType SerializationType, clientSide bool) ([]byte, error)
SerializeFragmentInfo serializes fragment info.
Deprecated: Use SerializeFragmentInfoToBuffer instead.
func SerializeFragmentInfoRequest(fragmentInfo *FragmentInfo, serializationType SerializationType, clientSide bool) ([]byte, error)
SerializeFragmentInfoRequest serializes fragment info.
Deprecated: Use SerializeFragmentInfoRequestToBuffer instead.
func SerializeGroupMetadata(g *Group, serializationType SerializationType) ([]byte, error)
SerializeGroupMetadata gets and serializes the group metadata
Deprecated: Use SerializeGroupMetadataToBuffer instead.
func SerializeQueryEstResultSizes(q *Query, serializationType SerializationType, clientSide bool) ([]byte, error)
SerializeQueryEstResultSizes gets and serializes the query estimated result sizes.
Deprecated: Use SerializeQueryEstResultSizesToBuffer instead.
Stats returns internal stats as string.
func StatsDisable() error
StatsDisable disables internal statistics gathering.
StatsDump prints internal stats to the given file path.
func StatsDumpSTDOUT() error
StatsDumpSTDOUT prints internal stats to stdout.
StatsEnable enables internal statistics gathering.
Example usage of tiledb statistics
err := StatsEnable() if err != nil { // Handle error }
// Perform tile operations err = StatsDumpSTDOUT() if err != nil { // Handle error }
StatsIsEnabled returns whether stats are enabled or not
StatsRaw returns internal raw (json) stats as string.
StatsRawDump prints internal raw (json) stats to the given file path.
func StatsRawDumpSTDOUT() error
StatsRawDumpSTDOUT prints internal raw (json) stats to stdout.
StatsReset resets all internal statistics counters to 0.
VacuumArray cleans up an array, such as consolidated fragments and array metadata.
func Version() (major int, minor int, rev int)
Version returns the TileDB shared library version these bindings are linked against at runtime.
major, minor, rev := Version() fmt.Printf("TileDB shared library version is %d.%d.%d", major, minor, rev)
Array struct representing a TileDB array object.
An Array object represents array data in TileDB at some persisted location, e.g. on disk, in an S3 bucket, etc. Once an array has been opened for reading or writing, interact with the data through Query objects.
func DeserializeArray(buffer Buffer, serializationType SerializationType, clientSide bool, arrayURI string) (Array, error)
DeserializeArray deserializes a new array from the given buffer.
NewArray allocates a new array. If the provided Context is nil, a default context is allocated and used.
// Create Config, this is optional config, err := NewConfig() if err != nil { // Handle error return }
// Test context with config context, err := NewContext(config) if err != nil { // Handle error return }
// Create Dimension dimension, err := NewDimension(context, "test", TILEDB_INT32, []int32{1, 10}, 5) if err != nil { // Handle error return }
// Create Domain domain, err := NewDomain(context) if err != nil { // Handle error return }
// Add dimension to domain err = domain.AddDimensions(dimension) if err != nil { // Handle error return }
arraySchema, err := NewArraySchema(context, TILEDB_DENSE) if err != nil { // Handle error return }
// Create attribute to add to schema attribute, err := NewAttribute(context, "a1", TILEDB_INT32)
if err != nil { // Handle error return }
err = arraySchema.AddAttributes(attribute) if err != nil { // Handle error return }
err = arraySchema.SetDomain(domain) if err != nil { // Handle error return }
err = CreateArray(context, "my_array", arraySchema) if err != nil { // Handle error return }
Close closes a tiledb array. This is automatically called on garbage collection.
Config gets the array config.
func (a *Array) Consolidate(config *Config) error
Consolidate consolidates the fragments of the array into a single fragment. You must first finalize all queries to the array before consolidation can begin (as consolidation temporarily acquires an exclusive lock on the array). Deprecated: Use ConsolidateArray instead.
func (a *Array) ConsolidateFragments(config *Config, fragmentList []string) error
ConsolidateFragments consolidates an explicit list of fragments in an array into a single fragment. You must first finalize all queries to the array before consolidation can begin (as consolidation temporarily acquires an exclusive lock on the array).
func (a *Array) Context() *Context
Context returns the TileDB context used to initialize the array.
func (a *Array) Create(arraySchema *ArraySchema) error
Create creates a new TileDB array given an input schema. Deprecated: Use CreateArray instead.
DeleteMetadata deletes a metadata key-value item from an open array. The array must be opened in WRITE mode, otherwise the function will error out.
Free releases the internal TileDB core data that was allocated on the C heap. It is automatically called when this object is garbage collected, but can be called earlier to manually release memory if needed. Free is idempotent and can safely be called many times on the same object; if it has already been freed, it will not be freed again.
GetEnumeration return the named Enumeration from the array schema.
GetMetadata gets a metadata key-value item from an open array. The array must be opened in READ mode, otherwise the function will error out.
GetMetadataFromIndex gets a metadata item from an open array using an index. The array must be opened in READ mode, otherwise the function will error out.
GetMetadataFromIndexWithValueLimit gets a metadata item from an open array using an index. The array must be opened in READ mode, otherwise the function will error out. limit parameter limits the number of values returned if string or array This is helpful for pushdown of limitting metadata. If nil value is returned in full.
GetMetadataMap returns a map with the array's metadata, indexed by their key.
GetMetadataMapWithValueLimit returns a map with the array's metadata, indexed by their key. The limit parameter limits the size of values returned if string or array. This is helpful for pushdown of limiting metadata. If nil, value is returned in full.
GetMetadataNum gets then number of metadata items in an open array. The array must be opened in READ mode, otherwise the function will error out.
func (a *Array) LoadAllEnumerations() error
LoadAllEnumeration is for use with TileDB cloud arrays. It fetches the enumeration values from the server. The method is called ondemand if the client tries to fetch enumeration values for a tiledb:// array.
func (a *Array) LoadEnumerationsAllSchemas() error
LoadEnumerationsAllSchemas is for use with TileDB cloud arrays. It fetches the enumeration values from the server for all array schemas, past and present.
func (a Array) NewSubarray() (Subarray, error)
NewSubarray creates a new subarray for array. It has internal coalesce_ranges == true.
func (*Array) NonEmptyDomain ¶
NonEmptyDomain retrieves the non-empty domain from an array. This returns the bounding coordinates for each dimension.
func (*Array) NonEmptyDomainFromIndex ¶ added in v0.9.0
NonEmptyDomainFromIndex retrieves the non-empty domain from an array for a given fixed-sized dimension index. Returns the bounding coordinates for the dimension.
func (*Array) NonEmptyDomainFromName ¶ added in v0.9.0
NonEmptyDomainFromName retrieves the non-empty domain from an array for a given fixed-sized dimension name. Returns the bounding coordinates for the dimension.
func (*Array) NonEmptyDomainMap ¶ added in v0.11.9
func (a *Array) NonEmptyDomainMap() (map[string]interface{}, error)
NonEmptyDomainMap returns a map[string]interface{} where key is the dimension name and value is the non empty domain for the given dimension or the empty interface. It covers both var-sized and non-var-sized dimensions.
func (*Array) NonEmptyDomainVarFromIndex ¶ added in v0.9.0
NonEmptyDomainVarFromIndex retrieves the non-empty domain from an array for a given var-sized dimension index. Supports only TILEDB_STRING_ASCII type Returns the bounding coordinates for the dimension.
func (*Array) NonEmptyDomainVarFromName ¶ added in v0.9.0
NonEmptyDomainVarFromName retrieves the non-empty domain from an array for a given var-sized dimension name. Supports only TILEDB_STRING_ASCII type Returns the bounding coordinates for the dimension.
func (a *Array) Open(queryType QueryType) error
Open the array. The array is opened using a query type as input. This is to indicate that queries created for this Array object will inherit the query type. In other words, Array objects are opened to receive only one type of queries. They can always be closed and be re-opened with another query type. Also there may be many different Array objects created and opened with different query types. For instance, one may create and open an array object array_read for reads and another one array_write for writes, and interleave creation and submission of queries for both these array objects.
OpenEndTime returns the current end_timestamp of an open array, converted to a UTC time.Time.
OpenEndTimestamp returns the current end_timestamp value of an open array.
OpenStartTime returns the current start_timestamp of an open array, converted to a UTC time.Time.
OpenStartTimestamp returns the current start_timestamp value of an open array.
func (a *Array) OpenWithOptions(queryType QueryType, opts ...ArrayOpenOption) error
OpenWithOptions opens the array with options. The array is opened using a query type as input. This is to indicate that queries created for this Array object will inherit the query type. In other words, Array objects are opened to receive only one type of query. They can always be closed and be re-opened with another query type. Also there may be many different Array objects created and opened with different query types. For instance, one may create and open an array object array_read for reads and another one array_write for writes, and interleave creation and submission of queries for both these array objects.
PutCharMetadata adds char metadata to the array.
func (a *Array) PutMetadata(key string, value interface{}) error
PutMetadata puts a metadata key-value item to an open array. The array must be opened in WRITE mode, otherwise the function will error out.
func (a *Array) QueryType() (QueryType, error)
QueryType returns the current query type of an open array.
Reopen the array (the array must be already open). This is useful when the array got updated after it got opened and the Array object got created. To sync-up with the updates, the user must either close the array and open with open(), or just use reopen() without closing. This function will be generally faster than the former alternative.
Schema returns the ArraySchema for the array.
func (a *Array) SetConfig(config *Config) error
SetConfig sets the array config.
URI returns the array's uri.
func (a *Array) Vacuum(config *Config) error
Vacuum cleans up the array, such as consolidated fragments and array metadata. Deprecated: Use VacuumArray instead.
type ArrayMetadata struct { Key string KeyLen uint32 Datatype Datatype ValueNum uint Value interface{} }
ArrayMetadata defines metadata for the array
MarshalJSON implements the Marshaler interface for ArrayMetadata.
type ArrayOpenOption func(tdbArray *Array) error
ArrayOpenOptions defines the flexible parameters in which arrays can be opened with.
WithEndTime sets the subsequent Open call to use the given time as its end timestamp. If "end" is the zero value, does nothing.
func WithEndTimestamp(endTimestamp uint64) ArrayOpenOption
WithEndTimestamp sets the subsequent Open call to use the end_timestamp of the passed value.
WithStartTime sets the subsequent Open call to use the given time as its start timestamp. If "start" is the zero value, does nothing.
func WithStartTimestamp(startTimestamp uint64) ArrayOpenOption
WithStartTimestamp sets the subsequent Open call to use the start_timestamp of the passed value.
type ArraySchema struct {
}
ArraySchema describes an array.
The schema is an independent description of an array. A schema can be used to create multiple array’s, and stores information about its domain, cell types, and compression details. An array schema is composed of:
A Domain A set of Attributes Memory layout definitions: tile and cell Compression details for Array level factors like offsets and coordinates
func DeserializeArrayCreate(buffer Buffer, serializationType SerializationType, clientSide bool) (ArraySchema, string, error)
DeserializeArrayCreate deserializes an array create request from the given buffer.
func DeserializeArraySchema(buffer Buffer, serializationType SerializationType, clientSide bool) (ArraySchema, error)
DeserializeArraySchema deserializes a new array schema from the given buffer.
LoadArraySchema reads a directory for an ArraySchema.
func NewArraySchema(tdbCtx Context, arrayType ArrayType) (ArraySchema, error)
NewArraySchema allocates a new ArraySchema.
// Create Config, this is optional config, err := NewConfig() if err != nil { // Handle error return }
// Test context with config context, err := NewContext(config) if err != nil { // Handle error return }
// Create Dimension dimension, err := NewDimension(context, "test", TILEDB_INT32, []int32{1, 10}, 5) if err != nil { // Handle error return }
// Create Domain domain, err := NewDomain(context) if err != nil { // Handle error return }
// Add dimension to domain err = domain.AddDimensions(dimension) if err != nil { // Handle error return }
arraySchema, err := NewArraySchema(context, TILEDB_DENSE) if err != nil { // Handle error return }
// Create attribute to add to schema attribute, err := NewAttribute(context, "a1", TILEDB_INT32)
if err != nil { // Handle error return }
err = arraySchema.AddAttributes(attribute) if err != nil { // Handle error return }
func NewArraySchemaForFile(tdbCtx Context, filePath string) (ArraySchema, error)
NewArraySchemaForFile allocates a new ArraySchema optimized for the storage of file. An empty path returns a general schema suitable for any file.
func (a ArraySchema) AddAttributes(attributes ...Attribute) error
AddAttributes adds one or more attributes to the array.
AddDimensionLabel adds a dimension label to the array schema.
func (a *ArraySchema) AddEnumeration(e *Enumeration) error
AddEnumeration adds the Enumeration to the schema. It must be added before we add it to an attribute.
AllowsDups gets whether the array can allow coordinate duplicates or not. It should always be `0` for dense arrays.
AttributeFromIndex gets a copy of an Attribute in the schema by name.
AttributeFromName gets a copy of an Attribute in the schema by index. Attributes are ordered the same way they were defined when constructing the array schema.
AttributeNum returns the number of attributes.
func (a ArraySchema) Attributes() ([]Attribute, error)
Attributes gets all attributes in the array.
Capacity returns the tile capacity.
CellOrder returns the cell order.
Check validates the schema.
func (a *ArraySchema) Context() *Context
Context exposes the internal TileDB context used to initialize the array schema.
func (a ArraySchema) CoordsFilterList() (FilterList, error)
CoordsFilterList returns a copy of the filter list of the coordinates.
DimensionLabelFromName retrieves a dimension label from an array schema with the requested index.
DimensionLabelFromName retrieves a dimension label from an array schema with the requested name.
DimensionLabelsNum returns the number of dimension label in this array schema
func (*ArraySchema) Domain ¶
Domain returns the array's domain.
Dump dumps the array schema in ASCII format to the given path.
DumpSTDOUT dumps the array schema in ASCII format to stdout.
DumpToString returns the array schema in ASCII format as a string.
EnumerationFromName gets an Enumeration from the ArraySchema by its Attribute name.
EnumerationFromName gets an Enumeration from the ArraySchema by name
func (a *ArraySchema) Free()
Free releases the internal TileDB core data that was allocated on the C heap. It is automatically called when this object is garbage collected, but can be called earlier to manually release memory if needed. Free is idempotent and can safely be called many times on the same object; if it has already been freed, it will not be freed again.
HasAttribute returns true if attribute: `attrName` is part of the schema.
HasDimensionLabel checks whether the array schema has a dimension label of the given name.
MarshalJSON marshals arraySchema struct to json using tiledb.
func (a ArraySchema) OffsetsFilterList() (FilterList, error)
OffsetsFilterList returns a copy of the FilterList of the offsets for variable-length attributes.
SetAllowsDups sets whether the array can allow coordinate duplicates or not. Applicable only to sparse arrays (it errors out if set to `1` for dense arrays).
SetCapacity sets the tile capacity.
func (a *ArraySchema) SetCellOrder(cellOrder Layout) error
SetCellOrder sets the cell order.
func (a *ArraySchema) SetCoordsFilterList(filterList *FilterList) error
SetCoordsFilterList sets the filter list used for coordinates.
func (a *ArraySchema) SetDimensionLabelFilterList(name string, filterList FilterList) error
SetDimensionLabelFilterList sets a filter on a dimension label filter in an array schema.
func (a *ArraySchema) SetDimensionLabelTileExtent(labelName string, dimType Datatype, extent interface{}) error
SetDimensionLabelTileExtent sets the tile extent for the dimension label
func (*ArraySchema) SetDomain ¶
func (a *ArraySchema) SetDomain(domain *Domain) error
SetDomain sets the array domain.
func (a *ArraySchema) SetOffsetsFilterList(filterList *FilterList) error
SetOffsetsFilterList sets the filter list for the offsets of variable-length attributes.
func (a *ArraySchema) SetTileOrder(tileOrder Layout) error
SetTileOrder sets the tile order.
TileOrder returns the tile order.
TimestampRange gets the timestamp range for the array schema.
Type fetches the tiledb array type.
UnmarshalJSON marshals arraySchema struct to json using tiledb.
type ArraySchemaEvolution struct {
}
func DeserializeArraySchemaEvolution(buffer Buffer, serializationType SerializationType, clientSide bool) (ArraySchemaEvolution, error)
DeserializeArraySchemaEvolution deserializes a new array schema evolution object from the given buffer.
func NewArraySchemaEvolution(tdbCtx Context) (ArraySchemaEvolution, error)
NewArraySchemaEvolution creates a TileDB schema evolution object.
func (ase *ArraySchemaEvolution) AddAttribute(attribute *Attribute) error
AddAttribute adds an attribute to an array schema evolution.
AddEnumeration adds enumeration to the schema evolution.
func (ase *ArraySchemaEvolution) ApplyExtendedEnumeration(e *Enumeration) error
ApplyExtendedEnumeration applies to the schema evolution the result of ExtendEnumeration.
func (ase *ArraySchemaEvolution) Context() *Context
Context exposes the internal TileDB context used to initialize the array schema evolution
DropAttribute drops an attribute to an array schema evolution.
DropEnumeration removes the enumeration from the schema evolution.
Evolve evolves array schema of an array.
func (ase *ArraySchemaEvolution) Free()
Free releases the internal TileDB core data that was allocated on the C heap. It is automatically called when this object is garbage collected, but can be called earlier to manually release memory if needed. Free is idempotent and can safely be called many times on the same object; if it has already been freed, it will not be freed again.
ArrayType enum for tiledb arrays
type Attribute struct {
}
Attribute describes an attribute of an Array cell.
An attribute specifies a name and datatype for a particular value in each array cell. There are 3 supported attribute types:
Fundamental types, such as char, int, double, uint64, etc.. Fixed sized arrays: [N]T or make([]T, N), where T is a fundamental type Variable length data: string, []T, where T is a fundamental type
NewAttribute allocates a new attribute.
// Create Config, this is optional config, err := NewConfig() if err != nil { // Handle error return }
// Test context with config context, err := NewContext(config) if err != nil { // Handle error return }
// Create Attribute attribute, err := NewAttribute(context, "test", TILEDB_INT32) if err != nil { // Handle error return }
// Set Filter List filter, err := NewFilter(context, TILEDB_FILTER_GZIP) if err != nil { // Handle error return } filterList, err := NewFilterList(context) if err != nil { // Handle error return } err = filterList.AddFilter(filter) if err != nil { // Handle error return } err = attribute.SetFilterList(filterList) if err != nil { // Handle error return }
// Set Cell Value Number err = attribute.SetCellValNum(10) if err != nil { // Handle error return }
CellSize gets the attribute cell size.
CellValNum returns number of values of one cell on this attribute. For variable-sized attributes returns TILEDB_VAR_NUM.
func (a *Attribute) Context() *Context
Context exposes the internal TileDB context used to initialize the attribute.
Dump dumps the attribute in ASCII format to the given path.
DumpSTDOUT dumps the attribute in ASCII format to stdout.
DumpToString returns the attribute in ASCII format as a string.
FilterList returns a copy of the filter list for attribute.
func (a *Attribute) Free()
Free releases the internal TileDB core data that was allocated on the C heap. It is automatically called when this object is garbage collected, but can be called earlier to manually release memory if needed. Free is idempotent and can safely be called many times on the same object; if it has already been freed, it will not be freed again.
GetEnumerationName returns the enumeration name of the attribute.
GetFillValue gets the default fill value for the input attribute. This value will be used for the input attribute whenever querying (1) an empty cell in a dense array, or (2) a non-empty cell (in either dense or sparse array) when values on the input attribute are missing (e.g., if the user writes a subset of the attributes in a write operation). Applicable to both fixed-sized and var-sized attributes.
GetFillValueNullable gets the default fill value for the input attribute. This value will be used for the input attribute whenever querying (1) an empty cell in a dense array, or (2) a non-empty cell (in either dense or sparse array) when values on the input attribute are missing (e.g., if the user writes a subset of the attributes in a write operation). Applicable to both fixed-sized and var-sized attributes.
Name returns the name of the attribute.
Nullable returns if the attribute is nullable or not.
SetCellValNum sets the number of attribute values per cell. This is inferred from the type parameter of the NewAttribute function, but can also be set manually.
SetEnumerationName sets the enumeration for the attribute. The enumeration must be set to the schema and the attribute maximum size must fit the size of the enumeration values.
func (a *Attribute) SetFillValue(value interface{}) error
SetFillValue sets the default fill value for the input attribute. This value will be used for the input attribute whenever querying (1) an empty cell in a dense array, or (2) a non-empty cell (in either dense or sparse array) when values on the input attribute are missing (e.g., if the user writes a subset of the attributes in a write operation). Applicable to var-sized attributes. @note A call to `tiledb_attribute_cell_val_num` sets the fill value
of the attribute to its default. Therefore, make sure you invoke
tiledb_attribute_set_fill_value after deciding on the number
of values this attribute will hold in each cell.
@note For fixed-sized attributes, the input `size` should be equal
to the cell size.
func (a *Attribute) SetFillValueNullable(value interface{}, valid bool) error
SetFillValueNullable sets the default fill value for the input attribute. This value will be used for the input attribute whenever querying (1) an empty cell in a dense array, or (2) a non-empty cell (in either dense or sparse array) when values on the input attribute are missing (e.g., if the user writes a subset of the attributes in a write operation). Applicable to var-sized attributes. @note A call to `tiledb_attribute_cell_val_num` sets the fill value
of the attribute to its default. Therefore, make sure you invoke
tiledb_attribute_set_fill_value after deciding on the number
of values this attribute will hold in each cell.
@note For fixed-sized attributes, the input `size` should be equal
to the cell size.
func (a *Attribute) SetFilterList(filterlist *FilterList) error
SetFilterList sets the attribute filterList.
// Create configuration config, err := NewConfig() if err != nil { // Handle error return }
// Test context with config context, err := NewContext(config) if err != nil { // Handle error return }
attribute, err := NewAttribute(context, "test", TILEDB_INT32) if err != nil { // Handle error return } // Set Filter List filter, err := NewFilter(context, TILEDB_FILTER_GZIP) if err != nil { // Handle error return }
err = filter.SetOption(TILEDB_COMPRESSION_LEVEL, int32(5)) if err != nil { // Handle error return }
filterList, err := NewFilterList(context) if err != nil { // Handle error return } err = filterList.AddFilter(filter) if err != nil { // Handle error return } err = attribute.SetFilterList(filterList) if err != nil { // Handle error return }
SetNullable sets if the attribute is nullable or not.
Type returns the attribute datatype.
Buffer A generic Buffer object used by some TileDB APIs
func DeserializeLoadEnumerationsRequest(array *Array, serializationType SerializationType, request Buffer) (Buffer, error)
DeserializeLoadEnumerationsRequest deserializes a LoadEnumerationsRequests. This is used by TileDB-Cloud.
func HandleConsolidationPlanRequest ¶ added in v0.26.0
func HandleConsolidationPlanRequest(array *Array, serializationType SerializationType, request Buffer) (Buffer, error)
HandleConsolidationPlanRequest handles a request for a consolidation plan. This is used by TileDB-Cloud It returns a buffer with the serialized response. The caller should free the buffer after use.
func HandleLoadArraySchemaRequest ¶ added in v0.30.3
func HandleLoadArraySchemaRequest(array *Array, request Buffer, serializationType SerializationType) (Buffer, error)
HandleLoadArraySchemaRequest Passes the array and serialized LoadArraySchemaRequest to core which returns the serialized LoadArraySchemaResponse. The request contains a TileDB Config used to load the schema, the response contains the latest array schema loaded and a map of all array schemas.
func HandleQueryPlanRequest ¶ added in v0.26.0
func HandleQueryPlanRequest(array *Array, serializationType SerializationType, request Buffer) (Buffer, error)
HandleQueryPlanRequest handles a request for a query plan. This is used by TileDB-Cloud It returns a buffer with the serialized response. The caller should free the buffer after use.
func NewBuffer(context Context) (Buffer, error)
NewBuffer allocates a new buffer.
// Create context with default config context, err := NewContext(nil) if err != nil { // Handle error return }
// Create Buffer buffer, err := NewBuffer(context) if err != nil { // Handle error return }
// Get data slice bytes, err := buffer.dataCopy() if err != nil { // Handle error return } fmt.Println(bytes)
Output:
[]
func SerializeArrayMetadataToBuffer(a Array, serializationType SerializationType) (Buffer, error)
SerializeArrayMetadataToBuffer gets and serializes the array metadata and returns a Buffer object containing the payload.
func SerializeArrayNonEmptyDomainAllDimensionsToBuffer ¶ added in v0.33.0
func SerializeArrayNonEmptyDomainAllDimensionsToBuffer(a Array, serializationType SerializationType) (Buffer, error)
SerializeArrayNonEmptyDomainAllDimensionsToBuffer gets and serializes the array nonempty domain and returns a Buffer object containing the payload.
func SerializeArrayNonEmptyDomainToBuffer ¶ added in v0.33.0
func SerializeArrayNonEmptyDomainToBuffer(a Array, serializationType SerializationType) (Buffer, error)
SerializeArrayNonEmptyDomainToBuffer gets and serializes the array nonempty domain and returns a Buffer object containing the payload.
func SerializeArraySchemaEvolutionToBuffer(arraySchemaEvolution ArraySchemaEvolution, serializationType SerializationType, clientSide bool) (Buffer, error)
SerializeArraySchemaEvolution serializes the given array schema evolution and serializes the group metadata and returns a Buffer object containing the payload.
func SerializeArraySchemaToBuffer(schema ArraySchema, serializationType SerializationType, clientSide bool) (Buffer, error)
SerializeArraySchemaToBuffer serializes an array schema and returns a Buffer object containing the payload.
func SerializeArrayToBuffer(array Array, serializationType SerializationType, clientSide bool) (Buffer, error)
SerializeArrayToBuffer serializes an array and returns a Buffer object containing the payload.
func SerializeFragmentInfoRequestToBuffer(fragmentInfo FragmentInfo, serializationType SerializationType, clientSide bool) (Buffer, error)
SerializeFragmentInfoRequestToBuffer serializes fragment info and returns a Buffer object containing the payload.
func SerializeFragmentInfoToBuffer(fragmentInfo FragmentInfo, serializationType SerializationType, clientSide bool) (Buffer, error)
SerializeFragmentInfoToBuffer serializes fragment info and returns a Buffer object containing the payload.
func SerializeGroupMetadataToBuffer(g Group, serializationType SerializationType) (Buffer, error)
SerializeGroupMetadataToBuffer gets and serializes the group metadata and returns a Buffer object containing the payload
func SerializeQueryEstResultSizesToBuffer(q Query, serializationType SerializationType, clientSide bool) (Buffer, error)
SerializeQueryEstResultSizesToBuffer gets and serializes the query estimated result sizes and returns a Buffer object containing the payload.
func (b *Buffer) Context() *Context
Context exposes the internal TileDB context used to initialize the buffer.
Free releases the internal TileDB core data that was allocated on the C heap. It is automatically called when this object is garbage collected, but can be called earlier to manually release memory if needed. Free is idempotent and can safely be called many times on the same object; if it has already been freed, it will not be freed again.
ReadAt writes the contents of a Buffer at a given offset to a slice.
Serialize returns a copy of the bytes in the buffer.
Deprecated: Use WriteTo or ReadAt instead for increased performance.
SetBuffer sets the buffer to point at the given Go slice. The memory is now Go-managed.
func (b *Buffer) SetType(datatype Datatype) error
SetType sets the buffer datatype.
Type returns the buffer datatype.
WriteTo writes the contents of a Buffer to an io.Writer.
type BufferList struct {
}
BufferList A list of TileDB BufferList objects
func NewBufferList(context Context) (BufferList, error)
NewBufferList Allocs a new buffer list
// Create context with default config context, err := NewContext(nil) if err != nil { // Handle error return }
// Create BufferList bufferList, err := NewBufferList(context) if err != nil { // Handle error return }
// Get num buffers numBuffers, err := bufferList.NumBuffers() if err != nil { // Handle error return } fmt.Println(numBuffers)
Output:
0
func SerializeQuery(query Query, serializationType SerializationType, clientSide bool) (BufferList, error)
SerializeQuery serializes a query.
func (b *BufferList) Context() *Context
Context exposes the internal TileDB context used to initialize the buffer list.
Flatten copies and concatenates all buffers in the list into a new buffer.
Deprecated: Use WriteTo instead for increased performance.
func (b *BufferList) Free()
Free releases the internal TileDB core data that was allocated on the C heap. It is automatically called when this object is garbage collected, but can be called earlier to manually release memory if needed. Free is idempotent and can safely be called many times on the same object; if it has already been freed, it will not be freed again.
GetBuffer returns a Buffer at the given index in the list.
NumBuffers returns number of buffers in the list.
TotalSize returns the total number of bytes in the buffers in the list.
WriteTo writes the contents of a BufferList to an io.Writer.
Config carries configuration parameters for a context.
LoadConfig reads a configuration from the given uri.
NewConfig allocates a new configuration.
func (c *Config) Cmp(other *Config) bool
Cmp compares two configs.
Free releases the internal TileDB core data that was allocated on the C heap. It is automatically called when this object is garbage collected, but can be called earlier to manually release memory if needed. Free is idempotent and can safely be called many times on the same object; if it has already been freed, it will not be freed again.
Get gets a parameter from the configuration by key.
config, err := NewConfig() if err != nil { // handle error }
val, err := config.Get("sm.memory_budget") if err != nil { // handle error } fmt.Println(val)
Output:
5368709120
Iterate iterates over configuration.
for iter, err := config.Iterate(); !iter.Done(); iter.Next(){ param, value, err := iter.Here() }
SaveToFile saves the config parameters to a (local) text file.
Set sets a config parameter-value pair.
config, err := NewConfig() if err != nil { // handle error }
err = config.Set("sm.memory_budget", "4294967296") if err != nil { // handle error }
val, err := config.Get("sm.memory_budget") if err != nil { // handle error } fmt.Println(val)
Output:
4294967296
Unset resets a config parameter to its default value.
type ConfigIter struct {
}
ConfigIter creates a config iterator object.
NewConfigIter creates an iterator for configuration. This can be used only for reading. This sets the pointer to the first search item.
Done checks if the iterator is done.
func (ci *ConfigIter) Free()
Free releases the internal TileDB core data that was allocated on the C heap. It is automatically called when this object is garbage collected, but can be called earlier to manually release memory if needed. Free is idempotent and can safely be called many times on the same object; if it has already been freed, it will not be freed again.
Here retrieves the param and value for the item currently pointed to by the iterator.
func (ci *ConfigIter) IsDone() bool
IsDone checks if the iterator is done.
Next moves the iterator to the next item.
Reset resets the config iterator.
type ConsolidationPlan struct {
}
ConsolidationPlan is a consolidation plan for array
GetConsolidationPlan creates a consolidation plan for the already opened array. The plan and the array will share the same tiledb context
DumpJSON returns a json serialization of the plan
FragmentURI returns the uri of the fragment of the node
func (cp *ConsolidationPlan) Free()
Free releases the internal TileDB core data that was allocated on the C heap. It is automatically called when this object is garbage collected, but can be called earlier to manually release memory if needed. Free is idempotent and can safely be called many times on the same object; if it has already been freed, it will not be freed again.
NumFragments returns the numner of fragments of the node
NumNodes returns the number of nodes for the plan
Context A TileDB context wraps a TileDB storage manager “instance.” Most objects and functions will require a Context. Internal error handling is also defined by the Context; the default error handler throws a TileDBError with a specific message.
func NewContext(config Config) (Context, error)
NewContext creates a TileDB context with the given configuration. If the configuration passed is nil, it is created with the default config.
ExampleNewContext example of creating a new context
// Create Context with default configuration: context, err := NewContext(nil) if err != nil { // handle error return }
// Create a config and use it to create a new Context: // (See ExampleConfig_Set for an example of setting config variables.) config, err := NewConfig() if err != nil { // handle error return } context, err = NewContext(config) if err != nil { // handle error return }
// Create a context directly from a configuration map: context, err = NewContextFromMap(map[string]string{ "sm.memory_budget": "17179869184", // 16 GiB "sm.memory_budget_var": "34359738368", // 32 GiB }) if err != nil { // handle error return }
stats, err := context.Stats() if err != nil { // Handle error return }
if len(stats) > 0 { // Do something with stats }
// Check if S3 is supported: isS3Supported, err := context.IsSupportedFS(TILEDB_S3) if err != nil { // handle error return }
Output:
true
NewContextFromMap creates a TileDB context with the given configuration. If the configuration passed is nil, it is created with the default config. This is a shortcut for creating a *Config from the given map and using it to create a new context.
func (c *Context) CancelAllTasks() error
CancelAllTasks cancels all currently executing tasks on the context.
Config retrieves a copy of the config from context.
DataProtocol returns the data protocol version for the given URI
Free releases the internal TileDB core data that was allocated on the C heap. It is automatically called when this object is garbage collected, but can be called earlier to manually release memory if needed. Free is idempotent and can safely be called many times on the same object; if it has already been freed, it will not be freed again.
IsSupportedFS returns true if the given filesystem backend is supported.
LastError returns the last error from this context.
SetTag sets the context tag.
Stats gets stats for a context as json bytes.
DataOrder
DataOrderFromString converts from a string to the equivalent DataOrder enum.
String returns a string representation of a DataOrder.
Datatype
DatatypeFromString converts from a datatype string to enum.
FromString converts from a datatype string to enum.
GetValue gets value stored in a void pointer for this data type.
MakeSlice makes a slice of the correct type corresponding to the datatype, with a given number of elements.
MarshalJSON implements the interface for marshaling to json.
ReflectKind returns the reflect kind given a datatype.
ReflectType returns the reflect type given a datatype.
Size returns the datatype size in bytes.
String returns a string representation.
UnmarshalJSON implements the interface for unmarshaling from json.
type Dimension struct {
}
Dimension Describes one dimension of an Array. The dimension consists of a type, lower and upper bound, and tile-extent describing the memory ordering. Dimensions are added to a Domain.
func NewDimension(context Context, name string, datatype Datatype, domain interface{}, extent interface{}) (Dimension, error)
NewDimension allocates a new dimension.
// Create Config, this is optional config, err := NewConfig() if err != nil { // Handle error return }
// Test context with config context, err := NewContext(config) if err != nil { // Handle error return }
// Create Dimension dim, err := NewDimension(context, "test", TILEDB_INT32, []int32{1, 10}, int32(5)) if err != nil { // Handle error return }
// Set Filter List filter, err := NewFilter(context, TILEDB_FILTER_GZIP) if err != nil { // Handle error return }
filterList, err := NewFilterList(context) if err != nil { // Handle error return }
err = filterList.AddFilter(filter) if err != nil { // Handle error return }
err = dim.SetFilterList(filterList) if err != nil { // Handle error return }
NewStringDimension allocates a new string dimension.
CellValNum returns the number of values of one cell on this attribute. For variable-sized attributes returns TILEDB_VAR_NUM.
func (d *Dimension) Context() *Context
Context exposes the internal TileDB context used to initialize the dimension.
func (*Dimension) Domain ¶
func (d *Dimension) Domain() (interface{}, error)
Domain returns the dimension's domain.
Dump dumps the dimension in ASCII format to the given path.
DumpSTDOUT dumps the dimension in ASCII format to stdout.
DumpToString returns the dimension in ASCII format as a string.
func (d *Dimension) Extent() (interface{}, error)
Extent returns the dimension's extent.
FilterList returns a copy of the filter list for attribute.
func (d *Dimension) Free()
Free releases the internal TileDB core data that was allocated on the C heap. It is automatically called when this object is garbage collected, but can be called earlier to manually release memory if needed. Free is idempotent and can safely be called many times on the same object; if it has already been freed, it will not be freed again.
Name returns the name of the dimension.
SetCellValNum sets the number of values per cell for a dimension. If this is not used, the default is `1`. This is inferred from the type parameter of the NewDimension function, but can also be set manually.
func (d *Dimension) SetFilterList(filterlist *FilterList) error
SetFilterList sets the dimension filterList.
Type returns the type of the dimension.
type DimensionLabel struct {
}
AttributeName returns the name of the attribute the label data is stored under.
CellValNum returns the number of values per cell for the labels on the dimension label. For variable-sized labels the result is TILEDB_VAR_NUM.
DimensionIndex returns the index of the dimension the dimension label provides labels for.
func (d *DimensionLabel) Free()
Free releases the internal TileDB core data that was allocated on the C heap. It is automatically called when this object is garbage collected, but can be called earlier to manually release memory if needed. Free is idempotent and can safely be called many times on the same object; if it has already been freed, it will not be freed again.
Name returns the name for the dimension label.
Order returns the order of the labels on the dimension label.
Type returns the underlying Datatype for the dimension label.
Uri Returns the Uri for the dimension label array.
DimensionType is a constraint for the types allowed for a TileDB dimension
type Domain ¶
Domain represents the domain of an array. A Domain defines the set of Dimension objects for a given array. The properties of a Domain derive from the underlying dimensions. A Domain is a component of an ArraySchema.
func NewDomain ¶
func NewDomain(tdbCtx Context) (Domain, error)
NewDomain allocates a new domain.
// Create Config, this is optional config, err := NewConfig() if err != nil { // Handle error return }
// Test context with config context, err := NewContext(config) if err != nil { // Handle error return }
// Create Dimension dimension, err := NewDimension(context, "test", TILEDB_INT32, []int32{1, 10}, int32(5)) if err != nil { // Handle error return }
// Create Domain domain, err := NewDomain(context) if err != nil { // Handle error return }
// Add dimension to domain err = domain.AddDimensions(dimension) if err != nil { // Handle error return }
func (*Domain) AddDimensions ¶
func (d Domain) AddDimensions(dimensions ...Dimension) error
AddDimensions adds one or more dimensions to a domain.
func (*Domain) Context ¶ added in v0.14.2
func (d *Domain) Context() *Context
Context exposes the internal TileDB context used to initialize the domain.
func (*Domain) DimensionFromIndex ¶
DimensionFromIndex retrieves a dimension object from a domain by index.
func (*Domain) DimensionFromName ¶
DimensionFromName retrieves a dimension object from a domain by name (key).
func (*Domain) Dump ¶
Dump dumps the domain in ASCII format to the given path.
func (*Domain) DumpSTDOUT ¶
func (d *Domain) DumpSTDOUT() error
DumpSTDOUT dumps the domain in ASCII format to stdout.
func (*Domain) DumpToString ¶ added in v0.37.1
DumpToString returns the domain in ASCII format as a string.
func (*Domain) Free ¶
Free releases the internal TileDB core data that was allocated on the C heap. It is automatically called when this object is garbage collected, but can be called earlier to manually release memory if needed. Free is idempotent and can safely be called many times on the same object; if it has already been freed, it will not be freed again.
func (*Domain) HasDimension ¶ added in v0.9.0
HasDimension returns true if dimension `dimName` is part of the domain.
func (*Domain) NDim ¶
NDim returns the number of dimensions.
func (*Domain) Type ¶
Type returns a domain's type deduced from dimensions.
type EncryptionType uint8
EncryptionType represents different encryption algorithms.
func (encryptionType EncryptionType) String() string
String returns a string representation.
type Enumeration struct {
}
Enumeration is a TileDB enumeration for Attributes
func ExtendEnumeration[T EnumerationType](tdbCtx *Context, e Enumeration, values []T) (Enumeration, error)
ExtendEnumeration extends an existing enumeration to add more values. The returned value should be used with ArraySchemaEvolution.ApplyExtendedEnumeration to make changes persistent.
func NewOrderedEnumeration[T EnumerationType](tdbCtx Context, name string, values []T) (Enumeration, error)
NewOrderedEnumeration creates an ordered enumeration with name and values.
func NewUnorderedEnumeration[T EnumerationType](tdbCtx Context, name string, values []T) (Enumeration, error)
NewOrderedEnumeration creates an unordered enumeration with name and values.
Type returns the number of cells for each enumeration value. It is 1 except for strings which is TILEDB_VAR_NUM.
Dump creates the file at path (must not exist) and writes a human-readable description of the enumeration.
DumpSTDOUT writes a human-readable description of the enumeration to os.Stdout.
DumpToString returns the enumeration in ASCII format as a string.
func (e *Enumeration) Free()
Free releases the internal TileDB core data that was allocated on the C heap. It is automatically called when this object is garbage collected, but can be called earlier to manually release memory if needed. Free is idempotent and can safely be called many times on the same object; if it has already been freed, it will not be freed again.
IsOrdered returns whether the enumerations values are ordered. Ordered values can be used with comparison operators in QueryConditions. Non-ordered values can be tested only for equality.
Name returns the name of the enumeration.
Type returns the TileDB type of the enumeration.
func (e *Enumeration) Values() (interface{}, error)
Values returns the enumeration values. The returned interface is a slice guaranteed to be cast to the type of the enumeration.
EnumerationType is a constraint on valid types for Enumerations
FS represents support fs types
File represents a TileDB filestore file. This is a regular TileDB array, you can query and checkout older versions, and it has a schema suitable to store files as byte arrays.
OpenFile opens for reading the array at arrayURI, which should have a filestore schema.
Read satisfies io.Reader.
FileStoreMimeType is an enum for TileDB filestore mime types
Filter represents
func NewFilter(context Context, filterType FilterType) (Filter, error)
NewFilter allocates a new filter.
func (f *Filter) Context() *Context
Context exposes the internal TileDB context used to initialize the filter.
Free releases the internal TileDB core data that was allocated on the C heap. It is automatically called when this object is garbage collected, but can be called earlier to manually release memory if needed. Free is idempotent and can safely be called many times on the same object; if it has already been freed, it will not be freed again.
func (f *Filter) Option(filterOption FilterOption) (interface{}, error)
Option fetches the specified option set on a filter. Returns an interface{} dependent on the option being fetched var optionValue int32 optionValueInterface, err := filter.Option(TILEDB_FILTER_GZIP) optionValue = optionValueInterface.(int32)
func (f *Filter) SetOption(filterOption FilterOption, valueInterface interface{}) error
SetOption sets an option on a filter. Options are filter dependent; this function returns an error if the given option is not valid for the given filter.
Type returns the filter type.
type FilterList struct {
}
FilterList represents
func NewFilterList(context Context) (FilterList, error)
Alloc a new FilterList
func (f *FilterList) AddFilter(filter *Filter) error
AddFilter appends a filter to a filter list. Data is processed through each filter in the order the filters were added.
func (f *FilterList) Context() *Context
Context exposes the internal TileDB context used to initialize the filter list
FilterFromIndex Retrieves a filter object from a filter list by index.
func (f FilterList) Filters() ([]Filter, error)
Filters return slice of filters applied to filter list
func (f *FilterList) Free()
Free releases the internal TileDB core data that was allocated on the C heap. It is automatically called when this object is garbage collected, but can be called earlier to manually release memory if needed. Free is idempotent and can safely be called many times on the same object; if it has already been freed, it will not be freed again.
MaxChunkSize Gets the maximum tile chunk size for a filter list.
NFilters Retrieves the number of filters in a filter list.
SetMaxChunkSize sets the maximum tile chunk size for a filter list.
FilterOption for a given filter
FilterType for attribute/coordinates/offsets filters
type FolderData struct { Folders []string Files []string Vfs *VFS }
FolderData is a type encapsulating list of folders and files
type FragmentInfo struct {
}
FragmentInfo struct representing a TileDB fragment info object.
A FragmentInfo object contains information about fragnents of an array that can be queried using methods taht have receiver type of *FragmentInfo
NewFragmentInfo allocates a new fragment info for a given array and fetches all the fragment information for that array.
Config gets the fragment config.
func (fI *FragmentInfo) Context() *Context
Context exposes the internal TileDB context used to initialize the fragment info.
DumpSTDOUT dumps the fragment info in ASCII format in the selected output.
func (fI *FragmentInfo) Free()
Free releases the internal TileDB core data that was allocated on the C heap. It is automatically called when this object is garbage collected, but can be called earlier to manually release memory if needed. Free is idempotent and can safely be called many times on the same object; if it has already been freed, it will not be freed again.
GetCellNum retrieves the number of cells written to the fragment by the user. In the case of sparse fragments, this is the number of non-empty cells in the fragment. In the case of dense fragments, TileDB may add fill values to populate partially populated tiles. Those fill values are counted in the returned number of cells. In other words, the cell number is derived from the number of *integral* tiles written in the file.
GetDense checks if a fragment is dense.
GetFragmentNum gets the number of fragments.
GetFragmentSize gets the fragment size in bytes.
GetFragmentURI gets a fragment URI. fid is the index of the fragment of interest.
func (*FragmentInfo) GetNonEmptyDomainFromIndex ¶ added in v0.11.0
GetNonEmptyDomainFromIndex retrieves the non-empty domain from a given fragment for a given dimension index. func (fI *FragmentInfo) GetNonEmptyDomainFromIndex
func (*FragmentInfo) GetNonEmptyDomainFromName ¶ added in v0.11.0
GetNonEmptyDomainFromName retrieves the non-empty domain from a given fragment for a given dimension name. func (fI *FragmentInfo) GetNonEmptyDomainFromName
func (*FragmentInfo) GetNonEmptyDomainVarFromIndex ¶ added in v0.11.0
GetNonEmptyDomainVarFromIndex retrieves the non-empty domain from a fragment for a given dimension index. Applicable to var-sized dimensions.
func (*FragmentInfo) GetNonEmptyDomainVarFromName ¶ added in v0.11.0
GetNonEmptyDomainVarFromName retrieves the non-empty domain from a fragment for a given dimension name. Applicable to var-sized dimensions.
func (*FragmentInfo) GetNonEmptyDomainVarSizeFromIndex ¶ added in v0.11.0
GetNonEmptyDomainVarSizeFromIndex retrieves the non-empty domain range sizes from a fragment for a given dimension index. Applicable to var-sized dimensions. func (fI *FragmentInfo) GetNonEmptyDomainVarSizeFromName
func (*FragmentInfo) GetNonEmptyDomainVarSizeFromName ¶ added in v0.11.0
GetNonEmptyDomainVarSizeFromName retrieves the non-empty domain range sizes from a fragment for a given dimension name. Applicable to var-sized dimensions.
GetSparse checks if a fragment is sparse.
GetTimestampRange gets the timestamp range of a fragment.
GetToVacuumNum gets the number of fragments to vacuum.
GetToVacuumURI gets the URI of the fragment to vacuum with the given index. fid is the index of the fragment of interest.
GetUnconsolidatedMetadataNum gets the number of fragments with unconsolidated metadata. func (fI *FragmentInfo) GetUnconsolidatedMetadataNum
GetVersion retrieves the format version of a fragment.
HasConsolidatedMetadata checks if a fragment has consolidated metadata.
Load loads the fragment info.
func (fI *FragmentInfo) SetConfig(config *Config) error
SetConfig sets the fragment config.
String retrieves the string representation of the FragmentInfo
type Freeable interface { Free() }
Freeable represents an object that can be Free'd at the end of its lifetime to release its resources.
Group represents a wrapped TileDB embedded group
NewGroup allocates an embedded group.
func (g *Group) AddMemberWithType(uri, name string, isRelativeURI bool, objectType ObjectTypeEnum) error
AddMemberWithType adds a member to the Group providing its type. This method is recommended for performance when operating on remote groups.
func (g *Group) Context() *Context
Context returns the TileDB context used to initialize the group.
Create creates a new TileDB group. Deprecated: Use CreateGroup instead.
Delete deletes written data from an open group. The group must be opened in MODIFY_EXCLUSIVE mode, otherwise the function will error out. Set recursive true if all data inside the group is to be deleted.
func (g *Group) Deserialize(buffer *Buffer, serializationType SerializationType, clientSide bool) error
Deserialize deserializes the group from the given buffer.
Dump the Group to a string value
GetIsRelativeURIByName returns whether a named member of the group has a uri relative to the group
GetMetadataMap returns a map with the group's metadata, indexed by their key.
GetMetadataMapWithValueLimit returns a map with the group's metadata, indexed by their key. The limit parameter limits the size of values returned if string or array. This is helpful for pushdown of limiting metadata. If nil, value is returned in full.
IsOpen returns true if the Group is open or false if the group is closed.
func (g *Group) Open(queryType QueryType) error
func (g *Group) PutMetadata(key string, value interface{}) error
PutMetadata puts a metadata key-value item to an open group. The group must be opened in WRITE mode, otherwise the function will error out.
func (g *Group) QueryType() (QueryType, error)
QueryType returns the QueryType for the currently opened group.
func (g *Group) SetConfig(config *Config) error
type GroupMetadata struct { Key string KeyLen uint32 Datatype Datatype ValueNum uint Value interface{} }
GroupMetadata defines metadata for the group
MarshalJSON implements the Marshaller interface for GroupMetadata
type NonEmptyDomain ¶ added in v0.4.0
type NonEmptyDomain struct { DimensionName string Bounds interface{} }
NonEmptyDomain contains the non empty dimension bounds and dimension name
type NumOfFragmentsData struct { NumOfFolders int Vfs *VFS }
NumOfFragmentsData is a type
type ObjectList struct {
}
ObjectList defines the value of data returned by object iteration callback
ObjectLs is similar to `tiledb_walk`, but now the function visits only the children of `path` (it does not recursively continue to the children directories).
ObjectWalk (iterates) over the TileDB objects contained in *path*. The traversal is done recursively in the order defined by the user. The user provides a callback function which is applied on each of the visited TileDB objects. The iteration continues for as long the callback returns non-zero, and stops when the callback returns 0. Note that this function ignores any object (e.g., file or directory) that is not TileDB-related.
ObjectTypeEnum
ObjectType returns the object type A TileDB "object" is currently either a TileDB array or a TileDB group.
ObjectTypeFromString returns the internal representation of the object type
String returns string representation
Query construct and execute read/write queries on a tiledb Array
func NewQuery(tdbCtx *Context, array Array) (Query, error)
NewQuery creates a TileDB query object.
If the provided Context is nil, the context of the Array is used instead. The storage manager also acquires a shared lock on the array. This means multiple read and write queries to the same array can be made concurrently (in TileDB, only consolidation requires an exclusive lock for a short period of time).
ExampleNewQuery shows a complete write and read example
// Create configuration config, err := NewConfig() if err != nil { // Handle error return }
// Test context with config context, err := NewContext(config) if err != nil { // Handle error return }
// Test create dimension dimension, err := NewDimension(context, "dim1", TILEDB_INT8, []int8{0, 9}, int8(10)) if err != nil { // Handle error return }
// Test creating domain domain, err := NewDomain(context) if err != nil { // Handle error return }
// Add dimension err = domain.AddDimensions(dimension) if err != nil { // Handle error return }
// Create array schema arraySchema, err := NewArraySchema(context, TILEDB_DENSE) if err != nil { // Handle error return }
// Create attribute to add to schema attribute, err := NewAttribute(context, "a1", TILEDB_INT32) if err != nil { // Handle error return }
// Create attribute to add to schema attribute2, err := NewAttribute(context, "a2", TILEDB_STRING_ASCII) if err != nil { // Handle error return }
// Create attribute to add to schema attribute3, err := NewAttribute(context, "a3", TILEDB_FLOAT32) if err != nil { // Handle error return }
// Create attribute to add to schema attribute4, err := NewAttribute(context, "a4", TILEDB_STRING_UTF8) if err != nil { // Handle error return }
// Set a3 to be variable length err = attribute3.SetCellValNum(TILEDB_VAR_NUM) if err != nil { // Handle error return }
// Set a4 to be variable length err = attribute4.SetCellValNum(TILEDB_VAR_NUM) if err != nil { // Handle error return }
// Add Attribute err = arraySchema.AddAttributes(attribute, attribute2, attribute3, attribute4) if err != nil { // Handle error return }
// Set Domain err = arraySchema.SetDomain(domain) if err != nil { // Handle error return }
// Validate Schema err = arraySchema.Check() if err != nil { // Handle error return }
// create temp array name and path // normal usage would be "my_array" uri // Temp path is used here so unit test can clean up after itself tmpArrayPath, err := os.MkdirTemp("", "tiledb_test_array") if err != nil { // Handle error return } defer os.RemoveAll(tmpArrayPath)
// Create array on disk err = CreateArray(context, tmpArrayPath, arraySchema) if err != nil { // Handle error return }
// Create new array struct array, err := NewArray(context, tmpArrayPath) if err != nil { // Handle error return }
// Open array for writting err = array.Open(TILEDB_WRITE) if err != nil { // Handle error return }
// Create write query query, err := NewQuery(context, array) if err != nil { // Handle error return }
// Create subarray subarray, err := array.NewSubarray() if err != nil { // Handle error return }
// Limit writting to subarray err = subarray.SetSubArray([]int8{0, 1}) if err != nil { // Handle error return }
// Set subarray to query err = query.SetSubarray(subarray) if err != nil { // Handle error return }
// Set write layout err = query.SetLayout(TILEDB_ROW_MAJOR) if err != nil { // Handle error return }
// Create write buffers bufferA1 := []int32{1, 2} _, err = query.SetDataBuffer("a1", bufferA1) if err != nil { // Handle error return }
bufferA2 := []byte("ab") _, err = query.SetDataBuffer("a2", bufferA2) if err != nil { // Handle error return }
bufferA3 := []float32{1.0, 2.0, 3.0, 4.0, 5.0} offsetBufferA3 := []uint64{0, 3} _, err = query.SetDataBuffer("a3", bufferA3) if err != nil { // Handle error return } _, err = query.SetOffsetsBuffer("a3", offsetBufferA3) if err != nil { // Handle error return }
bufferA4 := []byte("hello" + "world") offsetBufferA4 := []uint64{0, 5} _, err = query.SetDataBuffer("a4", bufferA4) if err != nil { // Handle error return } _, err = query.SetOffsetsBuffer("a4", offsetBufferA4) if err != nil { // Handle error return }
err = query.Submit() if err != nil { // Handle error return }
// Validate status, since query was used this is should be complete status, err := query.Status() if err != nil { // Handle error return } if status != TILEDB_COMPLETED { // handle non-complete query // If applicable read partial data in buffer // and re-submit for remaining results }
// Finalize Write err = query.Finalize() if err != nil { // Handle error return }
// Close and prepare to read err = array.Close() if err != nil { // Handle error return }
// Reopen array for reading err = array.Open(TILEDB_READ) if err != nil { // Handle error return }
// Create query for reading query, err = NewQuery(context, array) if err != nil { // Handle error return }
// Create subarray subarray, err = array.NewSubarray() if err != nil { // Handle error return }
// Set read subarray to only data that was written err = subarray.SetSubArray([]int8{0, 1}) if err != nil { // Handle error return }
// Set subarray to query err = query.SetSubarray(subarray) if err != nil { // Handle error return }
// Set empty buffers for reading readBufferA1 := make([]int32, 2) _, err = query.SetDataBuffer("a1", readBufferA1) if err != nil { // Handle error return }
readBufferA2 := make([]byte, 2) _, err = query.SetDataBuffer("a2", readBufferA2) if err != nil { // Handle error return }
readBufferA3 := make([]float32, 5) readOffsetBufferA3 := make([]uint64, 2) _, err = query.SetDataBuffer("a3", readBufferA3) if err != nil { // Handle error return } _, err = query.SetOffsetsBuffer("a3", readOffsetBufferA3) if err != nil { // Handle error return } readBufferA4 := make([]byte, 10) readOffsetBufferA4 := make([]uint64, 2) _, err = query.SetDataBuffer("a4", readBufferA4) if err != nil { // Handle error return } _, err = query.SetOffsetsBuffer("a4", readOffsetBufferA4) if err != nil { // Handle error return } // Set read layout err = query.SetLayout(TILEDB_ROW_MAJOR) if err != nil { // Handle error return } // Submit read query err = query.Submit() if err != nil { // Handle error return } // Wait for status to return complete or to error // Loop while status is inprogress for status, err = query.Status(); status == TILEDB_INPROGRESS && err == nil; status, err = query.Status() { // Do something while query is running } if err != nil { // Handle error return }
// Results should be returned hasResults, err := query.HasResults() if err != nil { // Handle error return } if hasResults { // Do something with read buffer }
stats, err := query.Stats() if err != nil { // Handle error return }
if len(stats) > 0 { // Do something with stats }
Array returns array used by query.
Config gets the config of query.
func (q *Query) Context() *Context
Context exposes the internal TileDB context used to initialize the query.
EstResultSize gets the query estimated result size in bytes for an attribute.
EstResultSizeNullable gets the query estimated result size in bytes for an attribute.
EstResultSizeVar gets the query estimated result size in bytes for a var sized attribute.
EstResultSizeVarNullable gets the query estimated result size in bytes for a var sized attribute.
EstimateBufferElements computes an upper bound on the buffer elements needed to read a subarray or range(s). Returns a map of attribute or dimension name to the maximum number of elements that can be read in the given subarray. For each attribute, a pair of numbers are returned. The first, for variable-length attributes, is the maximum number of offsets for that attribute in the given subarray. For fixed-length attributes and coordinates, the first is always 0. The second is the maximum number of elements for that attribute in the given subarray.
Finalize flushes all internal state of a query object and finalizes the query. This is applicable only to global layout writes. It has no effect for any other query type.
Free releases the internal TileDB core data that was allocated on the C heap. It is automatically called when this object is garbage collected, but can be called earlier to manually release memory if needed. Free is idempotent and can safely be called many times on the same object; if it has already been freed, it will not be freed again.
func (q *Query) GetDataBuffer(attributeOrDimension string) (interface{}, error)
GetDataBuffer retrieves the data buffer of an attribute/dimension.
GetExpectedDataBufferLength retrieves the size of the data buffer of an attribute/dimension. This is equivalent to calling GetDataBuffer and taking the length of the returned buffer except in the case of a deserialized server side read query where GetDataBuffer returns nil. Serialization of server side read queries serializes only lengths not buffers. The caller should use this method to get the size and allocate a buffer for the read query.
GetExpectedOffsetsBufferLength retrieves the size of the offset buffer for a var-sized attribute/dimension. This is equivalent to calling GetOffsetsBuffer and taking the length of the returned buffer except in the case of a deserialized read query where GetOffsetsBuffer returns nil. Serialization of read queries serializes only lengths not buffers. The caller should use this method to get the size and allocate a buffer for the read query.
GetExpectedValidityBufferLength retrieves the size of the validity buffer for a nullable attribute/dimension. This is equivalent to calling GetValidityBuffer and taking the length of the returned buffer except in the case of a deserialized read query where GetValidityBuffer returns nil. Serialization of read queries serializes only lengths not buffers. The caller should use this method to get the size and allocate a buffer for the read query.
GetFragmentNum returns num of fragments.
GetFragmentTimestampRange returns timestamp range for a fragment.
GetFragmentURI returns the uri for a fragment.
GetOffsetsBuffer retrieves the offset buffer for a var-sized attribute/dimension.
GetPlan returns a json encoding of the query plan for the query. Example:
{ "TileDB Query Plan": { "Array.Type": "sparse", "Array.URI": "file:///tmp/TestHandleQueryPlanRequest732268097/001/t-testhandlequeryplanrequest-b757271e", "Query.Attributes": [ "a1", "a2", "a3", "a4", "a5" ], "Query.Dimensions": [ "dim1" ], "Query.Layout": "unordered", "Query.Strategy.Name": "UnorderedWriter", "VFS.Backend": "file" } }
GetRanges gets the number of dimensions from the array under current query and builds an array of dimensions that have as memmbers arrays of ranges.
Deprecated: Use Subarrays
func (q Query) GetSubarray() (Subarray, error)
GetSubarray gets the subarray set on the query.
GetValidityBuffer retrieves the validity buffer for a nullable attribute/dimension.
HasResults returns true if the query has results. Applicable only to read queries (it returns false for write queries).
ResultBufferElements returns the number of elements in the result buffers from a read query. This is a map from the attribute name to a pair of values. The first is number of elements (offsets) for var size attributes, and the second is number of elements in the data buffer. For fixed sized attributes (and coordinates), the first is always 0.
func (q *Query) SetConfig(config *Config) error
SetConfig sets the config of query.
func (q Query) SetDataBuffer(attributeOrDimension string, buffer interface{}) (uint64, error)
SetDataBuffer sets the buffer for a fixed-sized attribute to a query.
SetDataBufferUnsafe sets the buffer for a fixed-sized attribute to a query. This takes an unsafe pointer which is passsed straight to tiledb c_api for advanced usage.
func (q *Query) SetLayout(layout Layout) error
SetLayout sets the layout of the cells to be written or read.
SetOffsetsBuffer sets the offset buffer for a var-sized attribute/dimension.
SetOffsetsBufferUnsafe sets the offset buffer for a var-sized attribute/dimension. This takes an unsafe pointer which is passed straight to tiledb c_api for advanced usage.
func (q *Query) SetQueryCondition(cond *QueryCondition) error
SetQueryCondition sets a query condition on a read query.
func (q *Query) SetSubarray(sa *Subarray) error
SetSubarray sets the subarray for the query.
SetValidityBuffer sets the validity buffer for nullable attribute/dimension.
SetValidityBufferUnsafe sets the validity buffer for nullable attribute/dimension. This takes an unsafe pointer which is passed straight to tiledb c_api for advanced usage.
Stats gets stats for a query as json bytes.
Status returns the status of a query.
StatusDetails returns extended query status details.
Submit a TileDB query This will block until query is completed
Note: Finalize() must be invoked after finish writing in global layout (via repeated invocations of Submit()), in order to flush any internal state. For the case of reads, if the returned status is TILEDB_INCOMPLETE, TileDB could not fit the entire result in the user’s buffers. In this case, the user should consume the read results (if any), optionally reset the buffers with SetBuffer(), and then resubmit the query until the status becomes TILEDB_COMPLETED. If all buffer sizes after the termination of this function become 0, then this means that no useful data was read into the buffers, implying that the larger buffers are needed for the query to proceed. In this case, the users must reallocate their buffers (increasing their size), reset the buffers with set_buffer(), and resubmit the query.
Type returns the query type.
type QueryCondition struct {
}
QueryCondition defines a condition used for a query.
func NewQueryCondition(tdbCtx Context, attributeName string, op QueryConditionOp, value interface{}) (QueryCondition, error)
NewQueryCondition allocates and initializes a new query condition.
ExampleNewQueryCondition shows a complete write, delete and read example
// Create configuration config, err := NewConfig() if err != nil { // Handle error return }
// Test context with config context, err := NewContext(config) if err != nil { // Handle error return }
// Test create dimension dimension, err := NewDimension(context, "dim1", TILEDB_INT8, []int8{0, 9}, int8(10)) if err != nil { // Handle error return }
// Test creating domain domain, err := NewDomain(context) if err != nil { // Handle error return }
// Add dimension err = domain.AddDimensions(dimension) if err != nil { // Handle error return }
// Create array schema arraySchema, err := NewArraySchema(context, TILEDB_SPARSE) if err != nil { // Handle error return }
// Create attribute to add to schema attribute, err := NewAttribute(context, "a1", TILEDB_INT32) if err != nil { // Handle error return }
// Add Attribute err = arraySchema.AddAttributes(attribute) if err != nil { // Handle error return }
// Set Domain err = arraySchema.SetDomain(domain) if err != nil { // Handle error return }
err = arraySchema.SetCellOrder(TILEDB_ROW_MAJOR) if err != nil { // Handle error return }
err = arraySchema.SetTileOrder(TILEDB_ROW_MAJOR) if err != nil { // Handle error return }
// Validate Schema err = arraySchema.Check() if err != nil { // Handle error return }
// create temp group name tmpArrayPath := os.TempDir()
// Create array on disk err = CreateArray(context, tmpArrayPath, arraySchema) if err != nil { // Handle error return }
// Create new array struct array, err := NewArray(context, tmpArrayPath) if err != nil { // Handle error return }
// Open array for writting err = array.Open(TILEDB_WRITE) if err != nil { // Handle error return }
// Create write query query, err := NewQuery(context, array) if err != nil { // Handle error return }
// Set write layout err = query.SetLayout(TILEDB_UNORDERED) if err != nil { // Handle error return }
// Create write buffers bufferA1 := []int32{1, 2, 3, 4} _, err = query.SetDataBuffer("a1", bufferA1) if err != nil { // Handle error return }
// Set coordinates, since test is 1d, this is subarray subArray := []int8{0, 1, 2, 3} _, err = query.SetDataBuffer("dim1", subArray) if err != nil { // Handle error return }
// Submit write query err = query.Submit() if err != nil { // Handle error return }
// Validate query type _, err = query.Type() if err != nil { // Handle error return }
// Finalize Write err = query.Finalize() if err != nil { // Handle error return } // Close and prepare to delete err = array.Close() if err != nil { // Handle error return }
// Prepare a Delete query for elements dim1[2,3] // Reopen array for deletion err = array.Open(TILEDB_DELETE) if err != nil { // Handle error return }
query, err = NewQuery(context, array) if err != nil { // Handle error return }
condition, err := NewQueryCondition(context, "dim1", TILEDB_QUERY_CONDITION_GE, int8(2)) if err != nil { // Handle error return }
err = query.SetQueryCondition(condition) if err != nil { // Handle error return }
// submit and finalize query err = query.Submit() if err != nil { // Handle error return } err = query.Finalize() if err != nil { // Handle error return } // Close and prepare to read err = array.Close() if err != nil { // Handle error return }
// Reopen array for reading err = array.Open(TILEDB_READ) if err != nil { // Handle error return }
query, err = NewQuery(context, array) if err != nil { // Handle error return }
// Set coordinates, since test is 1d, this is subarray _, err = query.SetDataBuffer("dim1", subArray) if err != nil { // Handle error return }
// Set empty buffers for reading readBufferA1 := make([]int32, 4) _, err = query.SetDataBuffer("a1", readBufferA1) if err != nil { // Handle error return }
// Set read layout err = query.SetLayout(TILEDB_ROW_MAJOR) if err != nil { // Handle error return }
// Submit read query async err = query.Submit() if err != nil { // Handle error return }
// Validate query type _, err = query.Type() if err != nil { // Handle error return }
// Results should be returned _, err = query.HasResults() if err != nil { // Handle error return }
func NewQueryConditionCombination(tdbCtx *Context, left *QueryCondition, op QueryConditionCombinationOp, right QueryCondition) (QueryCondition, error)
NewQueryConditionCombination combines two query conditions to create a new query condition. The underlying conditions are unchanged.
func NewQueryConditionNegated(tdbCtx *Context, qc QueryCondition) (QueryCondition, error)
NewQueryConditionNegated returns the negation of the query condition. The initial condition is unchanged.
func (qc *QueryCondition) Context() *Context
Context exposes the internal TileDB context used to initialize the query condition
func (qc *QueryCondition) Free()
Free releases the internal TileDB core data that was allocated on the C heap. It is automatically called when this object is garbage collected, but can be called earlier to manually release memory if needed. Free is idempotent and can safely be called many times on the same object; if it has already been freed, it will not be freed again.
UseEnumerations set true to allow query conditions with enumeration literals.
type QueryConditionCombinationOp uint8
QueryConditionCombinationOp operation type for a query condition combination
type QueryConditionOp uint8
QueryConditionOp operation type for a query condition
QueryStatus status of a query
String returns a string representation.
type QueryStatusDetails struct { IncompleteReason QueryStatusDetailsReason }
QueryStatusDetails contains detailed information about the query status
type QueryStatusDetailsReason uint8
QueryStatusDetailsReason indicates extended information about a returned query status in order to allow improved client-side handling of buffers and potential resubmissions.
String returns a string representation.
QueryType read or write query
QueryTypeFromString returns the internal representation of the query type.
Range is an 1D range along a subarray dimension
func MakeRange[T DimensionType](start, end T) Range
MakeRange returns a typed range [from, to]. It can be used with AddRange to add ranges to a dimension.
func (r Range) Endpoints() (start, end any)
Endpoints returns the endpoint of the range. This is useful to print the range or serialize it, without inferring the type first.
type RangeLimits struct {
}
RangeLimits defines a query range
MarshalJSON implements the Marshaler interface for RangeLimits.
type SerializationType int8
SerializationType how data is serialized
Subarray is a container of dimension ranges for a tiledb Query.
func (sa *Subarray) AddDimensionLabelRange(labelName string, r Range) error
AddDimensionLabelRange adds a range for a dimension label. It checks the types of range and label and if the datatype of the range is not the same as the type of the label it returns an error.
AddRange adds a range along a subarray dimension. It checks the types of range and dimension and if the datatype of the range is not the same as the type of the dimension it returns an error.
AddRangeByName adds a range along a subarray dimension. It checks the types of range and dimension and if the datatype of the range is not the same as the type of the dimension it returns an error.
func (sa *Subarray) Free()
Free releases the internal TileDB core data that was allocated on the C heap. It is automatically called when this object is garbage collected, but can be called earlier to manually release memory if needed. Free is idempotent and can safely be called many times on the same object.
GetDimensionLabelRange retrieves a specific range of the subarray along a given dimension label name.
GetDimensionLabelRangeNum returns the number of ranges for a dimension label
GetRange retrieves a specific range of the subarray along a given dimension index.
GetRangeFromName retrieves a specific range of the subarray along a given dimension name.
GetRangeNum retrieves the number of ranges of the query subarray along a given dimension index.
GetRangeNum retrieves the number of ranges of the query subarray along a given dimension name.
GetRanges gets the number of dimensions from the array under current subarray and builds an array of dimensions that have as memmbers arrays of ranges.
SetCoalesceRanges sets coalesce_ranges property on a TileDB subarray object. Intended to be used just after array.NewSubarray to replace the initial coalesce_ranges == true with coalesce_ranges = false if needed.
func (sa *Subarray) SetConfig(cfg *Config) error
SetConfig sets the subarray config. Currently it overrides only sm.read_range_oob.
func (sa *Subarray) SetSubArray(subArray interface{}) error
SetSubArray sets a subarray, defined in the order dimensions were added. Coordinates are inclusive. For the case of writes, this is meaningful only for dense arrays, and specifically dense writes.
VFS Implements a virtual filesystem that enables performing directory/file operations with a unified API on different filesystems, such as local posix/windows, HDFS, AWS S3, etc.
func NewVFS(context *Context, config Config) (VFS, error)
NewVFS alloc a new context using tiledb_vfs_alloc. This also registers the `runtime.SetFinalizer` for handling the free'ing of the c data structure on garbage collection
ExampleNewVFS show basic usage of tiledb's vfs functionality
// Create a new config config, err := NewConfig() if err != nil { // return err } // Optionally set config settings here // config.Set("key", "value")
// Create a context context, err := NewContext(config) if err != nil { // return err }
// Create a VFS instance vfs, err := NewVFS(context, config) if err != nil { // return err }
uri := "file:///tmp/tiledb_example_folder" // Check if directory exists if isDir, err := vfs.IsDir(uri); err != nil { fmt.Println(err) } else { // Directory exists if isDir { fmt.Println("URI is a directory") } else { fmt.Println("URI is not a directory")
Output:
URI is not a directory
Close closes a file. This is flushes the buffered data into the file when the file was opened in write (or append) mode. It is particularly important to be called after S3 writes, as otherwise the writes will not take effect.
func (v VFS) Config() (Config, error)
Config retrieves a copy of the config from vfs.
func (v *VFS) Context() *Context
Context exposes the internal TileDB context used to initialize the vfs.
CopyFile renames a TileDB file from an old URI to a new URI.
CreateBucket creates an object-store bucket with the input URI.
CreateDir creates a directory with the input URI.
DirSize retrieves the size of a directory.
EmptyBucket empties a bucket.
FileSize retrieves the size of a file.
Free releases the internal TileDB core data that was allocated on the C heap. It is automatically called when this object is garbage collected, but can be called earlier to manually release memory if needed. Free is idempotent and can safely be called many times on the same object; if it has already been freed, it will not be freed again.
IsBucket checks if an object-store bucket with the input URI exists.
IsDir checks if a directory with the input URI exists.
IsEmptyBucket checks if a bucket is empty.
IsFile checks if a file with the input URI exists.
List returns list of folders and files in a path.
MoveDir menames a TileDB directory from an old URI to a new URI.
MoveFile renames a TileDB file from an old URI to a new URI.
NumOfFragmentsInPath returns the number of folders in a path.
Open prepares a file for reading/writing.
Read reads part of a file.
RemoveBucket deletes an object-store bucket with the input URI.
RemoveDir removes a directory (recursively) with the input URI.
RemoveFile deletes a file with the input URI.
Touch touches a file, i.e., creates a new empty file. Existing files will not be overwritten.
VisitRecursive calls a function for every file in a path recursively. This function returns if the listing ends, or if the callback returns false or an error. Objects and directories will be traversed for local filesystems. Only objects will be traversed for cloud storage backends such as S3, Azure, and GCS.
Deprecated: Use VisitRecursiveV2 instead.
VisitRecursiveV2 calls a function for every file and directory in a path recursively. This function returns if the listing ends, or if the callback returns false or an error. Objects and directories will be traversed for all filesystems.
Write writes the contents of a buffer into a file. Note that this function only appends data at the end of the file. If the file does not exist, it will be created.
VFSMode is virtual file system file open mode
VFSfh is a virtual file system file handler
Close closes a file. This flushes the buffered data into the file when the file was opened in write (or append) mode. It is particularly important to be called after S3 writes, as otherwise the writes will not take effect.
func (v *VFSfh) Context() *Context
Context exposes the internal TileDB context used to initialize the vfsh.
Free releases the internal TileDB core data that was allocated on the C heap. It is automatically called when this object is garbage collected, but can be called earlier to manually release memory if needed. Free is idempotent and can safely be called many times on the same object; if it has already been freed, it will not be freed again.
IsClosed checks a vfs file handler to see if it is closed. Return true if file handler is closed, false if its not closed and error is non-nil on error
Read reads part of a file.
ReadAt reads part of a file at a given offset, without updating the object's internal offset.
Write writes the contents of a buffer into a file. Note that this function only appends data at the end of the file. If the file does not exist, it will be created.
VisitRecursiveCallback gets called by VFS.VisitRecursive. It returns whether visiting should continue, and maybe an error to propagate to the caller. If err is not nil, visiting always stops.
Deprecated: Use VisitRecursiveCallbackV2 instead.
VisitRecursiveCallbackV2 gets called by VFS.VisitRecursiveV2. If an error is returned, visiting stops.