Documentation
¶
Overview ¶
Package bigtable is an API to Google Cloud Bigtable.
See https://cloud.google.com/bigtable/docs/ for general product documentation.
See https://godoc.org/cloud.google.com/go for authentication, timeouts, connection pooling and similar aspects of this package.
Reading ¶
The principal way to read from a Bigtable is to use the ReadRows method on *Table. A RowRange specifies a contiguous portion of a table. A Filter may be provided through RowFilter to limit or transform the data that is returned.
tbl := client.Open("mytable")
// Read all the rows starting with "com.google.", but only fetch the columns
// in the "links" family.
rr := bigtable.PrefixRange("com.google.")
err := tbl.ReadRows(ctx, rr, func(r Row) bool {
// TODO: do something with r.
return true // Keep going.
}, bigtable.RowFilter(bigtable.FamilyFilter("links")))
if err != nil {
// TODO: handle err.
}
To read a single row, use the ReadRow helper method:
r, err := tbl.ReadRow(ctx, "com.google.cloud") // "com.google.cloud" is the entire row key
if err != nil {
// TODO: handle err.
}
// TODO: use r.
Writing ¶
This API exposes two distinct forms of writing to a Bigtable: a Mutation and a ReadModifyWrite. The former expresses idempotent operations. The latter expresses non-idempotent operations and returns the new values of updated cells. These operations are performed by creating a Mutation or ReadModifyWrite (with NewMutation or NewReadModifyWrite), building up one or more operations on that, and then using the Apply or ApplyReadModifyWrite methods on a Table.
For instance, to set a couple of cells in a table:
tbl := client.Open("mytable")
mut := bigtable.NewMutation()
// To use numeric values that will later be incremented,
// they need to be big-endian encoded as 64-bit integers.
buf := new(bytes.Buffer)
initialLinkCount := 1 // The initial number of links.
if err := binary.Write(buf, binary.BigEndian, initialLinkCount); err != nil {
// TODO: handle err.
}
mut.Set("links", "maps.google.com", bigtable.Now(), buf.Bytes())
mut.Set("links", "golang.org", bigtable.Now(), buf.Bytes())
err := tbl.Apply(ctx, "com.google.cloud", mut)
if err != nil {
// TODO: handle err.
}
To increment an encoded value in one cell:
tbl := client.Open("mytable")
rmw := bigtable.NewReadModifyWrite()
rmw.Increment("links", "golang.org", 12) // add 12 to the cell in column "links:golang.org"
r, err := tbl.ApplyReadModifyWrite(ctx, "com.google.cloud", rmw)
if err != nil {
// TODO: handle err.
}
// TODO: use r.
Retries ¶
If a read or write operation encounters a transient error it will be retried until a successful response, an unretryable error or the context deadline is reached. Non-idempotent writes (where the timestamp is set to ServerTime) will not be retried. In the case of ReadRows, retried calls will not re-scan rows that have already been processed.
Index ¶
- Constants
- func CheckDirectAccessSupported(ctx context.Context, project, instance, appProfile string, ...) (bool, error)
- func Equal(a, b Type) bool
- func GCRuleToString(rule *bttdpb.GcRule) string
- func MarshalJSON(t Type) ([]byte, error)
- type AdminClient
- func (ac *AdminClient) AuthorizedViewIAM(table, authorizedView string) *iam.Handle
- func (ac *AdminClient) AuthorizedViewInfo(ctx context.Context, tableID, authorizedViewID string) (*AuthorizedViewInfo, error)
- func (ac *AdminClient) AuthorizedViews(ctx context.Context, tableID string) ([]string, error)
- func (ac *AdminClient) BackupIAM(cluster, backup string) *iam.Handle
- func (ac *AdminClient) BackupInfo(ctx context.Context, cluster, backup string) (*BackupInfo, error)
- func (ac *AdminClient) Backups(ctx context.Context, cluster string) *BackupIterator
- func (ac *AdminClient) Close() error
- func (ac *AdminClient) CopyBackup(ctx context.Context, ...) error
- func (ac *AdminClient) CreateAuthorizedView(ctx context.Context, conf *AuthorizedViewConf) error
- func (ac *AdminClient) CreateBackup(ctx context.Context, table, cluster, backup string, expireTime time.Time) error
- func (ac *AdminClient) CreateBackupWithOptions(ctx context.Context, table, cluster, backup string, opts ...BackupOption) error
- func (ac *AdminClient) CreateColumnFamily(ctx context.Context, table, family string) error
- func (ac *AdminClient) CreateColumnFamilyWithConfig(ctx context.Context, table, family string, config Family) error
- func (ac *AdminClient) CreatePresplitTable(ctx context.Context, table string, splitKeys []string) error
- func (ac *AdminClient) CreateSchemaBundle(ctx context.Context, conf *SchemaBundleConf) error
- func (ac *AdminClient) CreateTable(ctx context.Context, table string) error
- func (ac *AdminClient) CreateTableFromConf(ctx context.Context, conf *TableConf) error
- func (ac *AdminClient) CreateTableFromSnapshot(ctx context.Context, table, cluster, snapshot string) error
- func (ac *AdminClient) DeleteAuthorizedView(ctx context.Context, tableID, authorizedViewID string) error
- func (ac *AdminClient) DeleteBackup(ctx context.Context, cluster, backup string) error
- func (ac *AdminClient) DeleteColumnFamily(ctx context.Context, table, family string) error
- func (ac *AdminClient) DeleteSchemaBundle(ctx context.Context, tableID, schemaBundleID string) error
- func (ac *AdminClient) DeleteSnapshot(ctx context.Context, cluster, snapshot string) error
- func (ac *AdminClient) DeleteTable(ctx context.Context, table string) error
- func (ac *AdminClient) DropAllRows(ctx context.Context, table string) error
- func (ac *AdminClient) DropRowRange(ctx context.Context, table, rowKeyPrefix string) error
- func (ac *AdminClient) EncryptionInfo(ctx context.Context, table string) (EncryptionInfoByCluster, error)
- func (ac *AdminClient) GetSchemaBundle(ctx context.Context, tableID, schemaBundleID string) (*SchemaBundleInfo, error)
- func (ac *AdminClient) RestoreTable(ctx context.Context, table, cluster, backup string) error
- func (ac *AdminClient) RestoreTableFrom(ctx context.Context, sourceInstance, table, sourceCluster, backup string) error
- func (ac *AdminClient) SchemaBundles(ctx context.Context, tableID string) ([]string, error)
- func (ac *AdminClient) SetGCPolicy(ctx context.Context, table, family string, policy GCPolicy) error
- func (ac *AdminClient) SetGCPolicyWithOptions(ctx context.Context, table, family string, policy GCPolicy, ...) error
- func (ac *AdminClient) SnapshotInfo(ctx context.Context, cluster, snapshot string) (*SnapshotInfo, error)
- func (ac *AdminClient) SnapshotTable(ctx context.Context, table, cluster, snapshot string, ttl time.Duration) error
- func (ac *AdminClient) Snapshots(ctx context.Context, cluster string) *SnapshotIterator
- func (ac *AdminClient) TableAdminClientV2() *admin.BigtableTableAdminClient
- func (ac *AdminClient) TableIAM(tableID string) *iam.Handle
- func (ac *AdminClient) TableInfo(ctx context.Context, table string) (*TableInfo, error)
- func (ac *AdminClient) Tables(ctx context.Context) ([]string, error)
- func (ac *AdminClient) UpdateAuthorizedView(ctx context.Context, conf UpdateAuthorizedViewConf) error
- func (ac *AdminClient) UpdateBackup(ctx context.Context, cluster, backup string, expireTime time.Time) error
- func (ac *AdminClient) UpdateBackupHotToStandardTime(ctx context.Context, cluster, backup string, hotToStandardTime time.Time) error
- func (ac *AdminClient) UpdateBackupRemoveHotToStandardTime(ctx context.Context, cluster, backup string) error
- func (ac *AdminClient) UpdateFamily(ctx context.Context, table, familyName string, family Family, ...) error
- func (ac *AdminClient) UpdateSchemaBundle(ctx context.Context, conf UpdateSchemaBundleConf) error
- func (ac *AdminClient) UpdateTableDisableAutomatedBackupPolicy(ctx context.Context, tableID string) error
- func (ac *AdminClient) UpdateTableDisableChangeStream(ctx context.Context, tableID string) error
- func (ac *AdminClient) UpdateTableRemoveRowKeySchema(ctx context.Context, tableID string) error
- func (ac *AdminClient) UpdateTableRemoveTieredStorageConfig(ctx context.Context, tableID string) error
- func (ac *AdminClient) UpdateTableWithAutomatedBackupPolicy(ctx context.Context, tableID string, ...) error
- func (ac *AdminClient) UpdateTableWithChangeStream(ctx context.Context, tableID string, ...) error
- func (ac *AdminClient) UpdateTableWithDeletionProtection(ctx context.Context, tableID string, deletionProtection DeletionProtection) error
- func (ac *AdminClient) UpdateTableWithRowKeySchema(ctx context.Context, tableID string, rowKeySchema StructType) error
- func (ac *AdminClient) UpdateTableWithTieredStorageConfig(ctx context.Context, tableID string, tieredStorageConfig *TieredStorageConfig) error
- func (ac *AdminClient) WaitForReplication(ctx context.Context, table string) error
- type AggregateType
- type Aggregator
- type AppProfileIsolation
- type AppProfilePriority
- type ApplyOption
- type ArraySQLType
- type AuthorizedViewConf
- type AuthorizedViewInfo
- type AutoscalingConfig
- type BackupInfo
- type BackupIterator
- type BackupOption
- type BackupType
- type BigEndianBytesEncoding
- type BoolSQLType
- type BoundStatement
- type BytesEncoding
- type BytesSQLType
- type BytesType
- type ChangeStreamRetention
- type Client
- func (c *Client) Close() error
- func (c *Client) Open(table string) *Table
- func (c *Client) OpenAuthorizedView(table, authorizedView string) TableAPI
- func (c *Client) OpenMaterializedView(materializedView string) TableAPI
- func (c *Client) OpenTable(table string) TableAPI
- func (c *Client) PingAndWarm(ctx context.Context) (err error)
- func (c *Client) PrepareStatement(ctx context.Context, query string, paramTypes map[string]SQLType, ...) (preparedStatement *PreparedStatement, err error)
- type ClientConfig
- type ClusterConfig
- type ClusterInfo
- type ColumnMetadata
- type DataBoostIsolationReadOnly
- type DateSQLType
- type DefaultMetricsProvider
- type DeletionProtection
- type Edition
- type EncryptionInfo
- type EncryptionInfoByCluster
- type EncryptionType
- type ErrPartiallyUnavailable
- type ExecuteOption
- type Family
- type FamilyInfo
- type FamilySubset
- type Filter
- func BlockAllFilter() Filter
- func CellsPerRowLimitFilter(n int) Filter
- func CellsPerRowOffsetFilter(n int) Filter
- func ChainFilters(sub ...Filter) Filter
- func ColumnFilter(pattern string) Filter
- func ColumnRangeFilter(family, start, end string) Filter
- func ConditionFilter(predicateFilter, trueFilter, falseFilter Filter) Filter
- func FamilyFilter(pattern string) Filter
- func InterleaveFilters(sub ...Filter) Filter
- func LabelFilter(label string) Filter
- func LatestNFilter(n int) Filter
- func PassAllFilter() Filter
- func RowKeyFilter(pattern string) Filter
- func RowSampleFilter(p float64) Filter
- func StripValueFilter() Filter
- func TimestampRangeFilter(startTime time.Time, endTime time.Time) Filter
- func TimestampRangeFilterMicros(startTime Timestamp, endTime Timestamp) Filter
- func ValueFilter(pattern string) Filter
- func ValueRangeFilter(start, end []byte) Filter
- type Float32SQLType
- type Float64SQLType
- type FullReadStats
- type FullReadStatsFunc
- type GCPolicy
- type GCPolicyOption
- type HllppUniqueCountAggregator
- type InstanceAdminClient
- func (iac *InstanceAdminClient) Close() error
- func (iac *InstanceAdminClient) Clusters(ctx context.Context, instanceID string) ([]*ClusterInfo, error)
- func (iac *InstanceAdminClient) CreateAppProfile(ctx context.Context, profile ProfileConf) (*btapb.AppProfile, error)
- func (iac *InstanceAdminClient) CreateCluster(ctx context.Context, conf *ClusterConfig) error
- func (iac *InstanceAdminClient) CreateInstance(ctx context.Context, conf *InstanceConf) error
- func (iac *InstanceAdminClient) CreateInstanceWithClusters(ctx context.Context, conf *InstanceWithClustersConfig) error
- func (iac *InstanceAdminClient) CreateLogicalView(ctx context.Context, instanceID string, conf *LogicalViewInfo) error
- func (iac *InstanceAdminClient) CreateMaterializedView(ctx context.Context, instanceID string, conf *MaterializedViewInfo) error
- func (iac *InstanceAdminClient) DeleteAppProfile(ctx context.Context, instanceID, name string) error
- func (iac *InstanceAdminClient) DeleteCluster(ctx context.Context, instanceID, clusterID string) error
- func (iac *InstanceAdminClient) DeleteInstance(ctx context.Context, instanceID string) error
- func (iac *InstanceAdminClient) DeleteLogicalView(ctx context.Context, instanceID, logicalViewID string) error
- func (iac *InstanceAdminClient) DeleteMaterializedView(ctx context.Context, instanceID, materializedViewID string) error
- func (iac *InstanceAdminClient) GetAppProfile(ctx context.Context, instanceID, name string) (*btapb.AppProfile, error)
- func (iac *InstanceAdminClient) GetCluster(ctx context.Context, instanceID, clusterID string) (*ClusterInfo, error)
- func (iac *InstanceAdminClient) InstanceAdminClientV2() *admin.BigtableInstanceAdminClient
- func (iac *InstanceAdminClient) InstanceIAM(instanceID string) *iam.Handle
- func (iac *InstanceAdminClient) InstanceInfo(ctx context.Context, instanceID string) (*InstanceInfo, error)
- func (iac *InstanceAdminClient) Instances(ctx context.Context) ([]*InstanceInfo, error)
- func (iac *InstanceAdminClient) ListAppProfiles(ctx context.Context, instanceID string) *ProfileIterator
- func (iac *InstanceAdminClient) LogicalViewInfo(ctx context.Context, instanceID, logicalViewID string) (*LogicalViewInfo, error)
- func (iac *InstanceAdminClient) LogicalViews(ctx context.Context, instanceID string) ([]LogicalViewInfo, error)
- func (iac *InstanceAdminClient) MaterializedViewInfo(ctx context.Context, instanceID, materializedViewID string) (*MaterializedViewInfo, error)
- func (iac *InstanceAdminClient) MaterializedViews(ctx context.Context, instanceID string) ([]MaterializedViewInfo, error)
- func (iac *InstanceAdminClient) SetAutoscaling(ctx context.Context, instanceID, clusterID string, conf AutoscalingConfig) error
- func (iac *InstanceAdminClient) UpdateAppProfile(ctx context.Context, instanceID, profileID string, ...) error
- func (iac *InstanceAdminClient) UpdateCluster(ctx context.Context, instanceID, clusterID string, serveNodes int32) error
- func (iac *InstanceAdminClient) UpdateInstanceWithClusters(ctx context.Context, conf *InstanceWithClustersConfig) error
- func (iac *InstanceAdminClient) UpdateLogicalView(ctx context.Context, instanceID string, conf LogicalViewInfo) error
- func (iac *InstanceAdminClient) UpdateMaterializedView(ctx context.Context, instanceID string, conf MaterializedViewInfo) error
- type InstanceConf
- type InstanceInfo
- type InstanceState
- type InstanceType
- type InstanceWithClustersConfig
- type Int64Encoding
- type Int64OrderedCodeBytesEncoding
- type Int64SQLType
- type Int64Type
- type IntersectionGCPolicy
- type IsolationComputeBillingOwner
- type LogicalViewInfo
- type MapSQLType
- type MaterializedViewInfo
- type MaxAgeGCPolicy
- type MaxAggregator
- type MaxVersionsGCPolicy
- type MetricsProvider
- type MinAggregator
- type MultiClusterRoutingUseAnyAffinity
- type MultiClusterRoutingUseAnyConfig
- type Mutation
- func (m *Mutation) AddIntToCell(family, column string, ts Timestamp, value int64)
- func (m *Mutation) DeleteCellsInColumn(family, column string)
- func (m *Mutation) DeleteCellsInFamily(family string)
- func (m *Mutation) DeleteRow()
- func (m *Mutation) DeleteTimestampRange(family, column string, start, end Timestamp)
- func (m *Mutation) MergeBytesToCell(family, column string, ts Timestamp, value []byte)
- func (m *Mutation) Set(family, column string, ts Timestamp, value []byte)
- type NodeScalingFactor
- type NoopMetricsProvider
- type PolicyType
- type PrepareOption
- type PreparedStatement
- type ProfileAttrsToUpdate
- type ProfileConf
- type ProfileIterator
- type ProtoSchemaInfo
- type RawBytesEncoding
- type ReadItem
- type ReadIterationStats
- type ReadModifyWrite
- type ReadOption
- type RequestLatencyStats
- type ResultRow
- type ResultRowMetadata
- type RoutingPolicyConfig
- type Row
- type RowAffinity
- type RowList
- type RowRange
- func InfiniteRange(start string) RowRange
- func InfiniteReverseRange(end string) RowRange
- func NewClosedOpenRange(start, end string) RowRange
- func NewClosedRange(start, end string) RowRange
- func NewOpenClosedRange(start, end string) RowRange
- func NewOpenRange(start, end string) RowRange
- func NewRange(begin, end string) RowRange
- func PrefixRange(prefix string) RowRange
- type RowRangeList
- type RowSet
- type SQLType
- type SchemaBundleConf
- type SchemaBundleInfo
- type SingleClusterRoutingConfig
- type SnapshotInfo
- type SnapshotIterator
- type StandardIsolation
- type Status
- type StorageType
- type StringEncoding
- type StringSQLType
- type StringType
- type StringUtf8BytesEncoding
- type StringUtf8Encoding
- type Struct
- type StructDelimitedBytesEncoding
- type StructEncoding
- type StructField
- type StructOrderedCodeBytesEncoding
- type StructSQLField
- type StructSQLType
- type StructSingletonEncoding
- type StructType
- type SubsetViewConf
- type SubsetViewInfo
- type SumAggregator
- type Table
- func (t *Table) Apply(ctx context.Context, row string, m *Mutation, opts ...ApplyOption) error
- func (t *Table) ApplyBulk(ctx context.Context, rowKeys []string, muts []*Mutation, opts ...ApplyOption) (errs []error, err error)
- func (t *Table) ApplyReadModifyWrite(ctx context.Context, row string, m *ReadModifyWrite) (Row, error)
- func (t *Table) ReadRow(ctx context.Context, row string, opts ...ReadOption) (Row, error)
- func (t *Table) ReadRows(ctx context.Context, arg RowSet, f func(Row) bool, opts ...ReadOption) error
- func (t *Table) SampleRowKeys(ctx context.Context) ([]string, error)
- type TableAPI
- type TableAutomatedBackupConfig
- type TableAutomatedBackupPolicy
- type TableConf
- type TableInfo
- type TableShim
- func (t *TableShim) Apply(ctx context.Context, row string, m *Mutation, opts ...ApplyOption) error
- func (t *TableShim) ApplyBulk(ctx context.Context, rowKeys []string, muts []*Mutation, opts ...ApplyOption) ([]error, error)
- func (t *TableShim) ApplyReadModifyWrite(ctx context.Context, row string, m *ReadModifyWrite) (Row, error)
- func (t *TableShim) ReadRow(ctx context.Context, row string, opts ...ReadOption) (Row, error)
- func (t *TableShim) ReadRows(ctx context.Context, arg RowSet, f func(Row) bool, opts ...ReadOption) error
- func (t *TableShim) SampleRowKeys(ctx context.Context) ([]string, error)
- type TieredStorageConfig
- type TieredStorageIncludeIfOlderThan
- type TieredStorageRule
- type Timestamp
- type TimestampEncoding
- type TimestampSQLType
- type TimestampType
- type TimestampUnixMicrosInt64Encoding
- type Type
- type TypeUnspecified
- type UnionGCPolicy
- type UpdateAuthorizedViewConf
- type UpdateFamilyOption
- type UpdateInstanceResults
- type UpdateSchemaBundleConf
- type UpdateTableConf
Examples ¶
Constants ¶
const ( // NotKnown represents the state of an instance that could not be determined. NotKnown InstanceState = InstanceState(btapb.Instance_STATE_NOT_KNOWN) // Ready represents the state of an instance that has been successfully created. Ready = InstanceState(btapb.Instance_READY) // Creating represents the state of an instance that is currently being created. Creating = InstanceState(btapb.Instance_CREATING) )
const ( // UNSPECIFIED instance types default to PRODUCTION UNSPECIFIED InstanceType = InstanceType(btapb.Instance_TYPE_UNSPECIFIED) PRODUCTION = InstanceType(btapb.Instance_PRODUCTION) DEVELOPMENT = InstanceType(btapb.Instance_DEVELOPMENT) )
const ( // Deprecated: Use MultiClusterRoutingUseAnyConfig instead. // MultiClusterRouting is a policy that allows read/write requests to be // routed to any cluster in the instance. Requests will will fail over to // another cluster in the event of transient errors or delays. Choosing // this option sacrifices read-your-writes consistency to improve // availability. MultiClusterRouting = "multi_cluster_routing_use_any" // Deprecated: Use SingleClusterRoutingConfig instead. // SingleClusterRouting is a policy that unconditionally routes all // read/write requests to a specific cluster. This option preserves // read-your-writes consistency, but does not improve availability. SingleClusterRouting = "single_cluster_routing" )
Routing policies.
const ( // Scope is the OAuth scope for Cloud Bigtable data operations. Scope = "https://www.googleapis.com/auth/bigtable.data" // ReadonlyScope is the OAuth scope for Cloud Bigtable read-only data // operations. ReadonlyScope = "https://www.googleapis.com/auth/bigtable.readonly" // AdminScope is the OAuth scope for Cloud Bigtable table admin operations. AdminScope = "https://www.googleapis.com/auth/bigtable.admin.table" // InstanceAdminScope is the OAuth scope for Cloud Bigtable instance (and // cluster) admin operations. InstanceAdminScope = "https://www.googleapis.com/auth/bigtable.admin.cluster" )
Scope constants for authentication credentials. These should be used when using credential creation functions such as oauth.NewServiceAccountFromFile.
const DefaultSnapshotDuration time.Duration = 0
DefaultSnapshotDuration is the default TTL for a snapshot.
Variables ¶
This section is empty.
Functions ¶
func CheckDirectAccessSupported ¶ added in v1.40.1
func CheckDirectAccessSupported(ctx context.Context, project, instance, appProfile string, opts ...option.ClientOption) (bool, error)
CheckDirectAccessSupported verifies if Direct Access connectivity is enabled, configured, and actively being used for the given Cloud Bigtable instance.
Example ¶
// Example Usage:
ctx := context.Background()
projectID := "my-project"
instanceID := "my-instance"
appProfileID := "default"
isDirectPath, err := CheckDirectAccessSupported(ctx, projectID, instanceID, appProfileID)
if err != nil {
log.Fatalf("DirectPath check failed: %v", err)
}
if isDirectPath {
log.Printf("DirectPath connectivity is active for %s/%s", projectID, instanceID)
} else {
log.Printf("DirectPath connectivity is NOT active for %s/%s", projectID, instanceID)
}
func GCRuleToString ¶
GCRuleToString converts the given GcRule proto to a user-visible string.
func MarshalJSON ¶ added in v1.30.0
MarshalJSON returns the string representation of the Type protobuf.
Types ¶
type AdminClient ¶
type AdminClient struct {
// contains filtered or unexported fields
}
AdminClient is a client type for performing admin operations within a specific instance.
func NewAdminClient ¶
func NewAdminClient(ctx context.Context, project, instance string, opts ...option.ClientOption) (*AdminClient, error)
NewAdminClient creates a new AdminClient for a given project and instance.
func (*AdminClient) AuthorizedViewIAM ¶ added in v1.23.0
func (ac *AdminClient) AuthorizedViewIAM(table, authorizedView string) *iam.Handle
AuthorizedViewIAM creates an IAM Handle specific to a given Table and AuthorizedView.
func (*AdminClient) AuthorizedViewInfo ¶ added in v1.23.0
func (ac *AdminClient) AuthorizedViewInfo(ctx context.Context, tableID, authorizedViewID string) (*AuthorizedViewInfo, error)
AuthorizedViewInfo retrieves information about an authorized view.
func (*AdminClient) AuthorizedViews ¶ added in v1.23.0
AuthorizedViews returns a list of the authorized views in the table.
func (*AdminClient) BackupIAM ¶ added in v1.7.0
func (ac *AdminClient) BackupIAM(cluster, backup string) *iam.Handle
BackupIAM creates an IAM Handle specific to a given Cluster and Backup.
func (*AdminClient) BackupInfo ¶ added in v1.5.0
func (ac *AdminClient) BackupInfo(ctx context.Context, cluster, backup string) (*BackupInfo, error)
BackupInfo gets backup metadata.
func (*AdminClient) Backups ¶ added in v1.5.0
func (ac *AdminClient) Backups(ctx context.Context, cluster string) *BackupIterator
Backups returns a BackupIterator for iterating over the backups in a cluster. To list backups across all of the clusters in the instance specify "-" as the cluster.
func (*AdminClient) CopyBackup ¶ added in v1.21.0
func (ac *AdminClient) CopyBackup(ctx context.Context, sourceCluster, sourceBackup, destProject, destInstance, destCluster, destBackup string, expireTime time.Time) error
CopyBackup copies the specified source backup with the user-provided expire time.
func (*AdminClient) CreateAuthorizedView ¶ added in v1.23.0
func (ac *AdminClient) CreateAuthorizedView(ctx context.Context, conf *AuthorizedViewConf) error
CreateAuthorizedView creates a new authorized view in a table.
func (*AdminClient) CreateBackup ¶ added in v1.5.0
func (ac *AdminClient) CreateBackup(ctx context.Context, table, cluster, backup string, expireTime time.Time) error
CreateBackup creates a new backup in the specified cluster from the specified source table with the user-provided expire time.
func (*AdminClient) CreateBackupWithOptions ¶ added in v1.35.0
func (ac *AdminClient) CreateBackupWithOptions(ctx context.Context, table, cluster, backup string, opts ...BackupOption) error
CreateBackupWithOptions is similar to CreateBackup but lets the user specify additional options.
func (*AdminClient) CreateColumnFamily ¶
func (ac *AdminClient) CreateColumnFamily(ctx context.Context, table, family string) error
CreateColumnFamily creates a new column family in a table.
func (*AdminClient) CreateColumnFamilyWithConfig ¶ added in v1.22.0
func (ac *AdminClient) CreateColumnFamilyWithConfig(ctx context.Context, table, family string, config Family) error
CreateColumnFamilyWithConfig creates a new column family in a table with an optional GC policy and value type.
func (*AdminClient) CreatePresplitTable ¶
func (ac *AdminClient) CreatePresplitTable(ctx context.Context, table string, splitKeys []string) error
CreatePresplitTable creates a new table in the instance. The list of row keys will be used to initially split the table into multiple tablets. Given two split keys, "s1" and "s2", three tablets will be created, spanning the key ranges: [, s1), [s1, s2), [s2, ). This method may return before the table's creation is complete.
func (*AdminClient) CreateSchemaBundle ¶ added in v1.39.0
func (ac *AdminClient) CreateSchemaBundle(ctx context.Context, conf *SchemaBundleConf) error
CreateSchemaBundle creates a new schema bundle in a table.
func (*AdminClient) CreateTable ¶
func (ac *AdminClient) CreateTable(ctx context.Context, table string) error
CreateTable creates a new table in the instance. This method may return before the table's creation is complete.
func (*AdminClient) CreateTableFromConf ¶
func (ac *AdminClient) CreateTableFromConf(ctx context.Context, conf *TableConf) error
CreateTableFromConf creates a new table in the instance from the given configuration.
func (*AdminClient) CreateTableFromSnapshot ¶
func (ac *AdminClient) CreateTableFromSnapshot(ctx context.Context, table, cluster, snapshot string) error
CreateTableFromSnapshot creates a table from snapshot. The table will be created in the same cluster as the snapshot.
This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.
func (*AdminClient) DeleteAuthorizedView ¶ added in v1.23.0
func (ac *AdminClient) DeleteAuthorizedView(ctx context.Context, tableID, authorizedViewID string) error
DeleteAuthorizedView deletes an authorized view in a table.
func (*AdminClient) DeleteBackup ¶ added in v1.5.0
func (ac *AdminClient) DeleteBackup(ctx context.Context, cluster, backup string) error
DeleteBackup deletes a backup in a cluster.
func (*AdminClient) DeleteColumnFamily ¶
func (ac *AdminClient) DeleteColumnFamily(ctx context.Context, table, family string) error
DeleteColumnFamily deletes a column family in a table and all of its data.
func (*AdminClient) DeleteSchemaBundle ¶ added in v1.39.0
func (ac *AdminClient) DeleteSchemaBundle(ctx context.Context, tableID, schemaBundleID string) error
DeleteSchemaBundle deletes a schema bundle in a table.
func (*AdminClient) DeleteSnapshot ¶
func (ac *AdminClient) DeleteSnapshot(ctx context.Context, cluster, snapshot string) error
DeleteSnapshot deletes a snapshot in a cluster.
This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.
func (*AdminClient) DeleteTable ¶
func (ac *AdminClient) DeleteTable(ctx context.Context, table string) error
DeleteTable deletes a table and all of its data.
func (*AdminClient) DropAllRows ¶ added in v1.1.0
func (ac *AdminClient) DropAllRows(ctx context.Context, table string) error
DropAllRows permanently deletes all rows from the specified table.
func (*AdminClient) DropRowRange ¶
func (ac *AdminClient) DropRowRange(ctx context.Context, table, rowKeyPrefix string) error
DropRowRange permanently deletes a row range from the specified table.
func (*AdminClient) EncryptionInfo ¶ added in v1.9.0
func (ac *AdminClient) EncryptionInfo(ctx context.Context, table string) (EncryptionInfoByCluster, error)
EncryptionInfo gets the current encryption info for the table across all of the clusters. The returned map will be keyed by cluster id and contain a status for all of the keys in use.
func (*AdminClient) GetSchemaBundle ¶ added in v1.39.0
func (ac *AdminClient) GetSchemaBundle(ctx context.Context, tableID, schemaBundleID string) (*SchemaBundleInfo, error)
GetSchemaBundle retrieves information about a schema bundle.
func (*AdminClient) RestoreTable ¶ added in v1.5.0
func (ac *AdminClient) RestoreTable(ctx context.Context, table, cluster, backup string) error
RestoreTable creates a table from a backup. The table will be created in the same cluster as the backup. To restore a table to a different instance, see RestoreTableFrom.
func (*AdminClient) RestoreTableFrom ¶ added in v1.10.0
func (ac *AdminClient) RestoreTableFrom(ctx context.Context, sourceInstance, table, sourceCluster, backup string) error
RestoreTableFrom creates a new table in the admin's instance by restoring from the given backup and instance. To restore within the same instance, see RestoreTable. sourceInstance (ex. "my-instance") and sourceCluster (ex. "my-cluster") are the instance and cluster in which the new table will be restored from. tableName (ex. "my-restored-table") will be the name of the newly created table. backupName (ex. "my-backup") is the name of the backup to restore.
func (*AdminClient) SchemaBundles ¶ added in v1.39.0
SchemaBundles returns a list of the schema bundles in the table.
func (*AdminClient) SetGCPolicy ¶
func (ac *AdminClient) SetGCPolicy(ctx context.Context, table, family string, policy GCPolicy) error
SetGCPolicy specifies which cells in a column family should be garbage collected. GC executes opportunistically in the background; table reads may return data matching the GC policy.
func (*AdminClient) SetGCPolicyWithOptions ¶ added in v1.24.0
func (ac *AdminClient) SetGCPolicyWithOptions(ctx context.Context, table, family string, policy GCPolicy, opts ...GCPolicyOption) error
SetGCPolicyWithOptions is similar to SetGCPolicy but allows passing options
func (*AdminClient) SnapshotInfo ¶
func (ac *AdminClient) SnapshotInfo(ctx context.Context, cluster, snapshot string) (*SnapshotInfo, error)
SnapshotInfo gets snapshot metadata.
This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.
func (*AdminClient) SnapshotTable ¶
func (ac *AdminClient) SnapshotTable(ctx context.Context, table, cluster, snapshot string, ttl time.Duration) error
SnapshotTable creates a new snapshot in the specified cluster from the specified source table. Setting the TTL to `DefaultSnapshotDuration` will use the server side default for the duration.
This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.
func (*AdminClient) Snapshots ¶
func (ac *AdminClient) Snapshots(ctx context.Context, cluster string) *SnapshotIterator
Snapshots returns a SnapshotIterator for iterating over the snapshots in a cluster. To list snapshots across all of the clusters in the instance specify "-" as the cluster.
This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.
func (*AdminClient) TableAdminClientV2 ¶ added in v1.50.0
func (ac *AdminClient) TableAdminClientV2() *admin.BigtableTableAdminClient
TableAdminClientV2 returns the GAPIC generated BigtableTableAdminClient.
The returned client shares the underlying connection pool with AdminClient. Since the connection pool is shared, calling Close on either the returned client or the parent AdminClient will close the connection pool, making both clients unusable.
func (*AdminClient) TableIAM ¶ added in v1.1.0
func (ac *AdminClient) TableIAM(tableID string) *iam.Handle
TableIAM creates an IAM Handle specific to a given Instance and Table within the configured project.
func (*AdminClient) Tables ¶
func (ac *AdminClient) Tables(ctx context.Context) ([]string, error)
Tables returns a list of the tables in the instance.
func (*AdminClient) UpdateAuthorizedView ¶ added in v1.23.0
func (ac *AdminClient) UpdateAuthorizedView(ctx context.Context, conf UpdateAuthorizedViewConf) error
UpdateAuthorizedView updates an authorized view in a table according to the given configuration.
func (*AdminClient) UpdateBackup ¶ added in v1.5.0
func (ac *AdminClient) UpdateBackup(ctx context.Context, cluster, backup string, expireTime time.Time) error
UpdateBackup updates the backup metadata in a cluster. The API only supports updating expire time.
func (*AdminClient) UpdateBackupHotToStandardTime ¶ added in v1.35.0
func (ac *AdminClient) UpdateBackupHotToStandardTime(ctx context.Context, cluster, backup string, hotToStandardTime time.Time) error
UpdateBackupHotToStandardTime updates the HotToStandardTime of a hot backup.
func (*AdminClient) UpdateBackupRemoveHotToStandardTime ¶ added in v1.35.0
func (ac *AdminClient) UpdateBackupRemoveHotToStandardTime(ctx context.Context, cluster, backup string) error
UpdateBackupRemoveHotToStandardTime removes the HotToStandardTime of a hot backup.
func (*AdminClient) UpdateFamily ¶ added in v1.30.0
func (ac *AdminClient) UpdateFamily(ctx context.Context, table, familyName string, family Family, opts ...UpdateFamilyOption) error
UpdateFamily updates column families' garbage collection policies and value type.
func (*AdminClient) UpdateSchemaBundle ¶ added in v1.39.0
func (ac *AdminClient) UpdateSchemaBundle(ctx context.Context, conf UpdateSchemaBundleConf) error
UpdateSchemaBundle updates a schema bundle in a table according to the given configuration.
func (*AdminClient) UpdateTableDisableAutomatedBackupPolicy ¶ added in v1.24.0
func (ac *AdminClient) UpdateTableDisableAutomatedBackupPolicy(ctx context.Context, tableID string) error
UpdateTableDisableAutomatedBackupPolicy updates a table to disable automated backups for table ID.
func (*AdminClient) UpdateTableDisableChangeStream ¶ added in v1.19.0
func (ac *AdminClient) UpdateTableDisableChangeStream(ctx context.Context, tableID string) error
UpdateTableDisableChangeStream updates a table to disable change stream for table ID.
func (*AdminClient) UpdateTableRemoveRowKeySchema ¶ added in v1.36.0
func (ac *AdminClient) UpdateTableRemoveRowKeySchema(ctx context.Context, tableID string) error
UpdateTableRemoveRowKeySchema removes a RowKeySchema from a table.
func (*AdminClient) UpdateTableRemoveTieredStorageConfig ¶ added in v1.43.0
func (ac *AdminClient) UpdateTableRemoveTieredStorageConfig(ctx context.Context, tableID string) error
UpdateTableRemoveTieredStorageConfig removes a TieredStorageConfig from a table.
func (*AdminClient) UpdateTableWithAutomatedBackupPolicy ¶ added in v1.24.0
func (ac *AdminClient) UpdateTableWithAutomatedBackupPolicy(ctx context.Context, tableID string, automatedBackupPolicy TableAutomatedBackupPolicy) error
UpdateTableWithAutomatedBackupPolicy updates a table to with the given table ID and automated backup policy config.
func (*AdminClient) UpdateTableWithChangeStream ¶ added in v1.19.0
func (ac *AdminClient) UpdateTableWithChangeStream(ctx context.Context, tableID string, changeStreamRetention ChangeStreamRetention) error
UpdateTableWithChangeStream updates a table to with the given table ID and change stream config.
func (*AdminClient) UpdateTableWithDeletionProtection ¶ added in v1.17.0
func (ac *AdminClient) UpdateTableWithDeletionProtection(ctx context.Context, tableID string, deletionProtection DeletionProtection) error
UpdateTableWithDeletionProtection updates a table with the given table ID and deletion protection parameter.
func (*AdminClient) UpdateTableWithRowKeySchema ¶ added in v1.36.0
func (ac *AdminClient) UpdateTableWithRowKeySchema(ctx context.Context, tableID string, rowKeySchema StructType) error
UpdateTableWithRowKeySchema updates a table with RowKeySchema.
func (*AdminClient) UpdateTableWithTieredStorageConfig ¶ added in v1.43.0
func (ac *AdminClient) UpdateTableWithTieredStorageConfig(ctx context.Context, tableID string, tieredStorageConfig *TieredStorageConfig) error
UpdateTableWithTieredStorageConfig updates a table with TieredStorageConfig.
func (*AdminClient) WaitForReplication ¶
func (ac *AdminClient) WaitForReplication(ctx context.Context, table string) error
WaitForReplication waits until all the writes committed before the call started have been propagated to all the clusters in the instance via replication.
type AggregateType ¶ added in v1.22.0
type AggregateType struct {
Input Type
Aggregator Aggregator
}
AggregateType represents an aggregate. See types.proto for more details on aggregate types.
type Aggregator ¶ added in v1.22.0
type Aggregator interface {
// contains filtered or unexported methods
}
Aggregator represents an aggregation function for an aggregate type.
type AppProfileIsolation ¶ added in v1.37.0
type AppProfileIsolation interface {
// contains filtered or unexported methods
}
AppProfileIsolation represents the configuration for a specific traffic isolation policy.
type AppProfilePriority ¶ added in v1.37.0
type AppProfilePriority int32
AppProfilePriority represents possible priorities for an app profile.
const ( // AppProfilePriorityUnspecified is the default value. Mapped to PRIORITY_HIGH (the legacy behavior) on creation. AppProfilePriorityUnspecified AppProfilePriority = AppProfilePriority(btapb.AppProfile_PRIORITY_UNSPECIFIED) // AppProfilePriorityLow represents the lowest priority. AppProfilePriorityLow AppProfilePriority = AppProfilePriority(btapb.AppProfile_PRIORITY_LOW) // AppProfilePriorityMedium represents the medium priority. AppProfilePriorityMedium AppProfilePriority = AppProfilePriority(btapb.AppProfile_PRIORITY_MEDIUM) // AppProfilePriorityHigh represents the highest priority. AppProfilePriorityHigh AppProfilePriority = AppProfilePriority(btapb.AppProfile_PRIORITY_HIGH) )
type ApplyOption ¶
type ApplyOption interface {
// contains filtered or unexported methods
}
An ApplyOption is an optional argument to Apply.
func GetCondMutationResult ¶
func GetCondMutationResult(matched *bool) ApplyOption
GetCondMutationResult returns an ApplyOption that reports whether the conditional mutation's condition matched.
type ArraySQLType ¶ added in v1.36.0
type ArraySQLType struct {
ElemType SQLType
}
ArraySQLType represents an ordered list of elements of a given type.
type AuthorizedViewConf ¶ added in v1.23.0
type AuthorizedViewConf struct {
TableID string
AuthorizedViewID string
// Types that are valid to be assigned to AuthorizedView:
// *SubsetViewConf
AuthorizedView isAuthorizedView
DeletionProtection DeletionProtection
}
AuthorizedViewConf contains information about an authorized view.
type AuthorizedViewInfo ¶ added in v1.23.0
type AuthorizedViewInfo struct {
TableID string
AuthorizedViewID string
AuthorizedView isAuthorizedViewInfo
DeletionProtection DeletionProtection
}
AuthorizedViewInfo contains authorized view metadata. This struct is read-only.
type AutoscalingConfig ¶ added in v1.13.0
type AutoscalingConfig struct {
// MinNodes sets the minimum number of nodes in a cluster. MinNodes must
// be 1 or greater.
MinNodes int
// MaxNodes sets the maximum number of nodes in a cluster. MaxNodes must be
// equal to or greater than MinNodes.
MaxNodes int
// CPUTargetPercent sets the CPU utilization target for your cluster's
// workload.
CPUTargetPercent int
// StorageUtilizationPerNode sets the storage usage target, in GB, for
// each node in a cluster. This number is limited between 2560 (2.5TiB) and
// 5120 (5TiB) for a SSD cluster and between 8192 (8TiB) and 16384 (16 TiB)
// for an HDD cluster. If set to zero, the default values are used:
// 2560 for SSD and 8192 for HDD.
StorageUtilizationPerNode int
}
AutoscalingConfig contains autoscaling configuration for a cluster. For details, see https://cloud.google.com/bigtable/docs/autoscaling.
type BackupInfo ¶ added in v1.5.0
type BackupInfo struct {
Name string
SourceTable string
SourceBackup string
SizeBytes int64
StartTime time.Time
EndTime time.Time
ExpireTime time.Time
State string
EncryptionInfo *EncryptionInfo
BackupType BackupType
// The time at which the hot backup will be converted to a standard backup.
// Once the `hot_to_standard_time` has passed, Cloud Bigtable will convert the
// hot backup to a standard backup. This value must be greater than the backup
// creation time by at least 24 hours
//
// This field only applies for hot backups.
HotToStandardTime *time.Time
}
BackupInfo contains backup metadata. This struct is read-only.
type BackupIterator ¶ added in v1.5.0
type BackupIterator struct {
// contains filtered or unexported fields
}
BackupIterator is an EntryIterator that iterates over log entries.
func (*BackupIterator) Next ¶ added in v1.5.0
func (it *BackupIterator) Next() (*BackupInfo, error)
Next returns the next result. Its second return value is iterator.Done (https://godoc.org/google.golang.org/api/iterator) if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*BackupIterator) PageInfo ¶ added in v1.5.0
func (it *BackupIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See https://godoc.org/google.golang.org/api/iterator package for details.
type BackupOption ¶ added in v1.35.0
type BackupOption func(*backupOptions)
BackupOption can be used to specify parameters for backup operations.
func WithExpiry ¶ added in v1.35.0
func WithExpiry(expireTime time.Time) BackupOption
WithExpiry option can be used to create backup that expires after time 'expireTime'. Once the 'expireTime' has passed, Cloud Bigtable will delete the backup.
func WithHotBackup ¶ added in v1.35.0
func WithHotBackup() BackupOption
WithHotBackup option can be used to create backup with type BackupTypeHot
func WithHotToStandardBackup ¶ added in v1.35.0
func WithHotToStandardBackup(hotToStandardTime time.Time) BackupOption
WithHotToStandardBackup option can be used to create backup with type BackupTypeHot and specify time at which the hot backup will be converted to a standard backup. Once the 'hotToStandardTime' has passed, Cloud Bigtable will convert the hot backup to a standard backup. This value must be greater than the backup creation time by at least 24 hours
type BackupType ¶ added in v1.35.0
type BackupType int32
BackupType denotes the type of the backup.
const ( // BackupTypeUnspecified denotes that backup type has not been specified. BackupTypeUnspecified BackupType = 0 // BackupTypeStandard is the default type for Cloud Bigtable managed backups. Supported for // backups created in both HDD and SSD instances. Requires optimization when // restored to a table in an SSD instance. BackupTypeStandard BackupType = 1 // BackupTypeHot is a backup type with faster restore to SSD performance. Only supported for // backups created in SSD instances. A new SSD table restored from a hot // backup reaches production performance more quickly than a standard // backup. BackupTypeHot BackupType = 2 )
type BigEndianBytesEncoding ¶ added in v1.22.0
type BigEndianBytesEncoding struct {
}
BigEndianBytesEncoding represents an Int64 encoding where the value is encoded as an 8-byte big-endian value.
type BoundStatement ¶ added in v1.36.0
type BoundStatement struct {
// contains filtered or unexported fields
}
BoundStatement is a statement that has been bound to a set of parameters. It is created by calling PreparedStatement.Bind.
func (*BoundStatement) Execute ¶ added in v1.36.0
func (bs *BoundStatement) Execute(ctx context.Context, f func(ResultRow) bool, opts ...ExecuteOption) (err error)
Execute executes a previously prepared query. f is called for each row in result set. If f returns false, the stream is shut down and Execute returns. f owns its argument, and f is called serially in order of results returned. f will be executed in the same Go routine as the caller.
type BytesEncoding ¶ added in v1.22.0
type BytesEncoding interface {
// contains filtered or unexported methods
}
BytesEncoding represents the encoding of a Bytes type.
type BytesSQLType ¶ added in v1.36.0
type BytesSQLType struct{}
BytesSQLType represents a slice of bytes.
type BytesType ¶ added in v1.22.0
type BytesType struct {
Encoding BytesEncoding
}
BytesType represents a string of bytes.
type ChangeStreamRetention ¶ added in v1.19.0
ChangeStreamRetention indicates how long bigtable should retain change data. Minimum is 1 day. Maximum is 7. nil to not change the retention period. 0 to disable change stream retention.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client for reading and writing data to tables in an instance.
A Client is safe to use concurrently, except for its Close method.
func NewClient ¶
func NewClient(ctx context.Context, project, instance string, opts ...option.ClientOption) (*Client, error)
NewClient creates a new Client for a given project and instance. The default ClientConfig will be used.
func NewClientWithConfig ¶
func NewClientWithConfig(ctx context.Context, project, instance string, config ClientConfig, opts ...option.ClientOption) (*Client, error)
NewClientWithConfig creates a new client with the given config.
func (*Client) Open ¶
Open opens a table. The returned *Table honors the Client's Diverter: when c.diverter is set, Apply and ReadRow are routed through an internal TableShim so calls can be diverted to the session data path under the diverter's SessionLoad ratio. Backward-compatible — the return type stays *Table and every method that already existed keeps its signature and behavior.
func (*Client) OpenAuthorizedView ¶ added in v1.23.0
OpenAuthorizedView opens an authorized view. See OpenTable for the diverter routing story.
func (*Client) OpenMaterializedView ¶ added in v1.36.0
OpenMaterializedView opens a materialized view. See OpenTable for the diverter routing story.
func (*Client) OpenTable ¶ added in v1.23.0
OpenTable opens a table. Returns a TableShim that routes each RPC via the Client's Diverter — with sessionLoad=0.0 every call lands on the classic path. The session TableAPI is wired from the Client's sessionImpl when present; it's nil when the caller pre-dialed a custom gRPC conn or opted out via ClientConfig.DisableSession, in which case the shim runs classic-only and useSession() reports false. Server-driven SessionLoad updates from ClientConfigurationManager retarget traffic without re-opening the table.
func (*Client) PingAndWarm ¶ added in v1.39.0
PingAndWarm pings the server and warms up the connection.
func (*Client) PrepareStatement ¶ added in v1.36.0
func (c *Client) PrepareStatement(ctx context.Context, query string, paramTypes map[string]SQLType, opts ...PrepareOption) (preparedStatement *PreparedStatement, err error)
PrepareStatement prepares a query for execution. If possible, this should be called once and reused across requests. This will amortize the cost of query preparation.
The query string can be a parameterized query containing placeholders in the form of @ followed by the parameter name Parameter names may consist of any combination of letters, numbers, and underscores.
Parameters can appear anywhere that a literal value is expected. The same parameter name can be used more than once, for example: WHERE cf["qualifier1"] = @value OR cf["qualifier2"] = @value
type ClientConfig ¶
type ClientConfig struct {
// The id of the app profile to associate with all data operations sent from this client.
// If unspecified, the default app profile for the instance will be used.
AppProfile string
// MetricsProvider controls the built-in client-side metrics.
//
// Leave unset (nil) or set to DefaultMetricsProvider{} to enable the
// built-in Cloud Monitoring exporter (default behavior). Set to
// NoopMetricsProvider{} to disable metrics entirely.
//
// TODO: support user provided meter provider
MetricsProvider MetricsProvider
// DisableDynamicChannelPool disables the dynamic channel resizing based on load
// Dynamic channel resizing is enabled by default to resize based on load and avoid queuing of requests.
DisableDynamicChannelPool bool
// DisableConnectionRecycler disables the automatic preemptive refresh of connection.
// Preemptive connection is default to true
DisableConnectionRecycler bool
// DisableDirectAccess disables direct access by default.
DisableDirectAccess bool
// DisableSession, when true, tells NewClientWithConfig to skip
// constructing the session data-plane client entirely. sessionImpl
// and sessionTables are left nil; the client runs classic-only and
// pays none of the session infrastructure's per-connection background
// goroutines or gRPC-channel cost.
//
// Effect on Table: Open() returns a *Table whose divertible field is
// still built (Diverter is a classic-side concern), but its session
// side is nil, so TableShim.useSession() reports false and every
// Apply / ReadRow routes to the classic path unconditionally.
//
// Intended for callers who have specific reasons to opt out of the
// session data plane — running against a backend that doesn't
// support it, benchmarking classic-only baselines, or resource-
// constrained environments where the +N goroutines + +MB RSS of an
// idle session pool matter. Default (false) keeps the current
// behavior: session client is always constructed.
DisableSession bool
}
ClientConfig has configurations for the client.
type ClusterConfig ¶
type ClusterConfig struct {
// InstanceID specifies the unique name of the instance. Required.
InstanceID string
// ClusterID specifies the unique name of the cluster. Required.
ClusterID string
// Zone specifies the location where this cluster's nodes and storage reside.
// For best performance, clients should be located as close as possible to this
// cluster. Required.
Zone string
// NumNodes specifies the number of nodes allocated to this cluster. More
// nodes enable higher throughput and more consistent performance. One of
// NumNodes or AutoscalingConfig is required. If both are set,
// AutoscalingConfig takes precedence.
NumNodes int32
// StorageType specifies the type of storage used by this cluster to serve
// its parent instance's tables, unless explicitly overridden. Required.
StorageType StorageType
// KMSKeyName is the name of the KMS customer managed encryption key (CMEK)
// to use for at-rest encryption of data in this cluster. If omitted,
// Google's default encryption will be used. If specified, the requirements
// for this key are:
// 1) The Cloud Bigtable service account associated with the
// project that contains the cluster must be granted the
// “cloudkms.cryptoKeyEncrypterDecrypter“ role on the
// CMEK.
// 2) Only regional keys can be used and the region of the
// CMEK key must match the region of the cluster.
// 3) All clusters within an instance must use the same CMEK
// key.
// Optional. Immutable.
KMSKeyName string
// AutoscalingConfig configures the autoscaling properties on a cluster.
// One of NumNodes or AutoscalingConfig is required.
AutoscalingConfig *AutoscalingConfig
// NodeScalingFactor controls the scaling factor of the cluster (i.e. the
// increment in which NumNodes can be set). Node scaling delivers better
// latency and more throughput by removing node boundaries. It is optional,
// with the default being 1X.
NodeScalingFactor NodeScalingFactor
}
ClusterConfig contains the information necessary to create a cluster
type ClusterInfo ¶
type ClusterInfo struct {
// Name is the name of the cluster.
Name string
// Zone is the GCP zone of the cluster (e.g. "us-central1-a").
Zone string
// ServeNodes is the number of allocated serve nodes.
ServeNodes int
// State is the state of the cluster.
State string
// StorageType is the storage type of the cluster.
StorageType StorageType
// KMSKeyName is the customer managed encryption key for the cluster.
KMSKeyName string
// AutoscalingConfig are the configured values for a cluster.
AutoscalingConfig *AutoscalingConfig
// NodeScalingFactor controls the scaling factor of the cluster.
NodeScalingFactor NodeScalingFactor
}
ClusterInfo represents information about a cluster.
type ColumnMetadata ¶ added in v1.36.0
type ColumnMetadata struct {
// Name is the name of the column as returned by the query (e.g., alias or derived name).
Name string
// SQLType provides the original Bigtable SQL type information. This can be useful
// for understanding the underlying storage or type details.
SQLType SQLType
}
ColumnMetadata describes a single column in a ResultRowMetadata.
type DataBoostIsolationReadOnly ¶ added in v1.37.0
type DataBoostIsolationReadOnly struct {
// Compute Billing Owner specifies how usage should be accounted when using
// Data Boost. Compute Billing Owner also configures which Cloud Project is
// charged for relevant quota.
ComputeBillingOwner IsolationComputeBillingOwner
}
DataBoostIsolationReadOnly configures Data Boost isolation. Data Boost is a serverless compute capability that lets you run high-throughput read jobs and queries on your Bigtable data, without impacting the performance of the clusters that handle your application traffic. Data Boost supports read-only use cases with single-cluster routing.
type DateSQLType ¶ added in v1.36.0
type DateSQLType struct{}
DateSQLType represents a calendar date.
type DefaultMetricsProvider ¶ added in v1.51.0
type DefaultMetricsProvider = metrics.DefaultMetricsProvider
DefaultMetricsProvider enables the built-in Cloud Monitoring metrics exporter (the same behavior as leaving ClientConfig.MetricsProvider nil). Type alias to the internal metrics package's implementation.
type DeletionProtection ¶ added in v1.17.0
type DeletionProtection int
DeletionProtection indicates whether the table, authorized view, logical view or materialized view is protected against data loss i.e. when set to protected, deleting the view, the table, the column families in the table, and the instance containing the table or view would be prohibited.
const ( None DeletionProtection = iota Protected Unprotected )
None indicates that deletion protection is unset Protected indicates that deletion protection is enabled Unprotected indicates that deletion protection is disabled
type Edition ¶ added in v1.47.0
type Edition int32
Edition is the edition of the instance.
const ( // EditionUnspecified defaults to ENTERPRISE EditionUnspecified Edition = Edition(btapb.Instance_EDITION_UNSPECIFIED) // Enterprise edition is the default edition. Enterprise Edition = Edition(btapb.Instance_ENTERPRISE) // EnterprisePlus edition is the edition with higher limits and more features than Enterprise edition. EnterprisePlus Edition = Edition(btapb.Instance_ENTERPRISE_PLUS) )
type EncryptionInfo ¶ added in v1.9.0
type EncryptionInfo struct {
Status *Status
Type EncryptionType
KMSKeyVersion string
}
EncryptionInfo represents the encryption info of a table.
type EncryptionInfoByCluster ¶ added in v1.9.0
type EncryptionInfoByCluster map[string][]*EncryptionInfo
EncryptionInfoByCluster is a map of cluster name to EncryptionInfo
type EncryptionType ¶ added in v1.9.0
type EncryptionType int32
EncryptionType is the type of encryption for an instance.
const ( // EncryptionTypeUnspecified is the type was not specified, though data at rest remains encrypted. EncryptionTypeUnspecified EncryptionType = iota // GoogleDefaultEncryption represents that data backing this resource is // encrypted at rest with a key that is fully managed by Google. No key // version or status will be populated. This is the default state. GoogleDefaultEncryption // CustomerManagedEncryption represents that data backing this resource is // encrypted at rest with a key that is managed by the customer. // The in-use version of the key and its status are populated for // CMEK-protected tables. // CMEK-protected backups are pinned to the key version that was in use at // the time the backup was taken. This key version is populated but its // status is not tracked and is reported as `UNKNOWN`. CustomerManagedEncryption )
type ErrPartiallyUnavailable ¶ added in v1.6.0
type ErrPartiallyUnavailable struct {
}
ErrPartiallyUnavailable is returned when some locations (clusters) are unavailable. Both partial results (retrieved from available locations) and the error are returned when this exception occurred.
func (ErrPartiallyUnavailable) Error ¶ added in v1.6.0
func (e ErrPartiallyUnavailable) Error() string
type ExecuteOption ¶ added in v1.36.0
type ExecuteOption interface{}
ExecuteOption is an optional argument to Execute.
type Family ¶ added in v1.22.0
Family represents a column family with its optional GC policy and value type.
type FamilyInfo ¶
FamilyInfo represents information about a column family.
type FamilySubset ¶ added in v1.23.0
FamilySubset represents a subset of a column family.
type Filter ¶
type Filter interface {
String() string
// contains filtered or unexported methods
}
A Filter represents a row filter.
func BlockAllFilter ¶
func BlockAllFilter() Filter
BlockAllFilter returns a filter that matches nothing.
func CellsPerRowLimitFilter ¶
CellsPerRowLimitFilter returns a filter that matches only the first N cells of each row.
func CellsPerRowOffsetFilter ¶
CellsPerRowOffsetFilter returns a filter that skips the first N cells of each row, matching all subsequent cells.
func ChainFilters ¶
ChainFilters returns a filter that applies a sequence of filters.
func ColumnFilter ¶
ColumnFilter returns a filter that matches cells whose column name matches the provided RE2 pattern. See https://github.com/google/re2/wiki/Syntax for the accepted syntax.
func ColumnRangeFilter ¶
ColumnRangeFilter returns a filter that matches a contiguous range of columns within a single family, as specified by an inclusive start qualifier and exclusive end qualifier.
func ConditionFilter ¶
ConditionFilter returns a filter that evaluates to one of two possible filters depending on whether or not the given predicate filter matches at least one cell. If the matched filter is nil then no results will be returned. IMPORTANT NOTE: The predicate filter does not execute atomically with the true and false filters, which may lead to inconsistent or unexpected results. Additionally, condition filters have poor performance, especially when filters are set for the false condition.
func FamilyFilter ¶
FamilyFilter returns a filter that matches cells whose family name matches the provided RE2 pattern. See https://github.com/google/re2/wiki/Syntax for the accepted syntax.
func InterleaveFilters ¶
InterleaveFilters returns a filter that applies a set of filters in parallel and interleaves the results.
func LabelFilter ¶ added in v1.6.0
LabelFilter returns a filter that applies the given label to all cells in the output row.
func LatestNFilter ¶
LatestNFilter returns a filter that matches the most recent N cells in each column.
func PassAllFilter ¶
func PassAllFilter() Filter
PassAllFilter returns a filter that matches everything.
func RowKeyFilter ¶
RowKeyFilter returns a filter that matches cells from rows whose key matches the provided RE2 pattern. See https://github.com/google/re2/wiki/Syntax for the accepted syntax.
func RowSampleFilter ¶
RowSampleFilter returns a filter that matches a row with a probability of p (must be in the interval (0, 1)).
func StripValueFilter ¶
func StripValueFilter() Filter
StripValueFilter returns a filter that replaces each value with the empty string.
func TimestampRangeFilter ¶
TimestampRangeFilter returns a filter that matches any cells whose timestamp is within the given time bounds. A zero time means no bound. The timestamp will be truncated to millisecond granularity.
func TimestampRangeFilterMicros ¶
TimestampRangeFilterMicros returns a filter that matches any cells whose timestamp is within the given time bounds, specified in units of microseconds since 1 January 1970. A zero value for the end time is interpreted as no bound. The timestamp will be truncated to millisecond granularity.
func ValueFilter ¶
ValueFilter returns a filter that matches cells whose value matches the provided RE2 pattern. See https://github.com/google/re2/wiki/Syntax for the accepted syntax.
func ValueRangeFilter ¶
ValueRangeFilter returns a filter that matches cells with values that fall within the given range, as specified by an inclusive start value and exclusive end value.
type Float32SQLType ¶ added in v1.36.0
type Float32SQLType struct{}
Float32SQLType represents a 32-bit floating-point number.
type Float64SQLType ¶ added in v1.36.0
type Float64SQLType struct{}
Float64SQLType represents a 64-bit floating-point number.
type FullReadStats ¶ added in v1.18.0
type FullReadStats struct {
// Iteration stats describe how efficient the read is, e.g. comparing rows seen vs. rows
// returned or cells seen vs cells returned can provide an indication of read efficiency
// (the higher the ratio of seen to retuned the better).
ReadIterationStats ReadIterationStats
// Request latency stats describe the time taken to complete a request, from the server
// side.
RequestLatencyStats RequestLatencyStats
}
FullReadStats captures all known information about a read.
type FullReadStatsFunc ¶ added in v1.18.0
type FullReadStatsFunc func(*FullReadStats)
FullReadStatsFunc describes a callback that receives a FullReadStats for evaluation.
type GCPolicy ¶
type GCPolicy interface {
String() string
// contains filtered or unexported methods
}
A GCPolicy represents a rule that determines which cells are eligible for garbage collection.
func IntersectionPolicy ¶
IntersectionPolicy returns a GC policy that only applies when all its sub-policies apply.
func MaxAgePolicy ¶
MaxAgePolicy returns a GC policy that applies to all cells older than the given age.
func MaxVersionsPolicy ¶
MaxVersionsPolicy returns a GC policy that applies to all versions of a cell except for the most recent n.
func NoGcPolicy ¶
func NoGcPolicy() GCPolicy
NoGcPolicy applies to all cells setting maxage and maxversions to nil implies no gc policies
func UnionPolicy ¶
UnionPolicy returns a GC policy that applies when any of its sub-policies apply.
type GCPolicyOption ¶ added in v1.24.0
type GCPolicyOption interface {
// contains filtered or unexported methods
}
GCPolicyOption is deprecated, kept for backwards compatibility, use UpdateFamilyOption in new code
func IgnoreWarnings ¶ added in v1.24.0
func IgnoreWarnings() GCPolicyOption
IgnoreWarnings returns a updateFamilyOption that ignores safety checks when modifying the column families
type HllppUniqueCountAggregator ¶ added in v1.28.0
type HllppUniqueCountAggregator struct{}
HllppUniqueCountAggregator is an aggregation function that calculates the unique count of inputs and the accumulator.
type InstanceAdminClient ¶
type InstanceAdminClient struct {
// contains filtered or unexported fields
}
InstanceAdminClient is a client type for performing admin operations on instances. These operations can be substantially more dangerous than those provided by AdminClient.
func NewInstanceAdminClient ¶
func NewInstanceAdminClient(ctx context.Context, project string, opts ...option.ClientOption) (*InstanceAdminClient, error)
NewInstanceAdminClient creates a new InstanceAdminClient for a given project.
func (*InstanceAdminClient) Close ¶
func (iac *InstanceAdminClient) Close() error
Close closes the InstanceAdminClient.
func (*InstanceAdminClient) Clusters ¶
func (iac *InstanceAdminClient) Clusters(ctx context.Context, instanceID string) ([]*ClusterInfo, error)
Clusters lists the clusters in an instance. If any location (cluster) is unavailable due to some transient conditions, Clusters returns partial results and ErrPartiallyUnavailable error with unavailable locations list.
func (*InstanceAdminClient) CreateAppProfile ¶
func (iac *InstanceAdminClient) CreateAppProfile(ctx context.Context, profile ProfileConf) (*btapb.AppProfile, error)
CreateAppProfile creates an app profile within an instance.
func (*InstanceAdminClient) CreateCluster ¶
func (iac *InstanceAdminClient) CreateCluster(ctx context.Context, conf *ClusterConfig) error
CreateCluster creates a new cluster in an instance. This method will return when the cluster has been created or when an error occurs.
func (*InstanceAdminClient) CreateInstance ¶
func (iac *InstanceAdminClient) CreateInstance(ctx context.Context, conf *InstanceConf) error
CreateInstance creates a new instance in the project. This method will return when the instance has been created or when an error occurs.
func (*InstanceAdminClient) CreateInstanceWithClusters ¶
func (iac *InstanceAdminClient) CreateInstanceWithClusters(ctx context.Context, conf *InstanceWithClustersConfig) error
CreateInstanceWithClusters creates a new instance with configured clusters in the project. This method will return when the instance has been created or when an error occurs.
func (*InstanceAdminClient) CreateLogicalView ¶ added in v1.36.0
func (iac *InstanceAdminClient) CreateLogicalView(ctx context.Context, instanceID string, conf *LogicalViewInfo) error
CreateLogicalView creates a new logical view in an instance.
func (*InstanceAdminClient) CreateMaterializedView ¶ added in v1.36.0
func (iac *InstanceAdminClient) CreateMaterializedView(ctx context.Context, instanceID string, conf *MaterializedViewInfo) error
CreateMaterializedView creates a new materialized view in an instance.
func (*InstanceAdminClient) DeleteAppProfile ¶
func (iac *InstanceAdminClient) DeleteAppProfile(ctx context.Context, instanceID, name string) error
DeleteAppProfile deletes an app profile from an instance.
func (*InstanceAdminClient) DeleteCluster ¶
func (iac *InstanceAdminClient) DeleteCluster(ctx context.Context, instanceID, clusterID string) error
DeleteCluster deletes a cluster from an instance.
func (*InstanceAdminClient) DeleteInstance ¶
func (iac *InstanceAdminClient) DeleteInstance(ctx context.Context, instanceID string) error
DeleteInstance deletes an instance from the project.
func (*InstanceAdminClient) DeleteLogicalView ¶ added in v1.36.0
func (iac *InstanceAdminClient) DeleteLogicalView(ctx context.Context, instanceID, logicalViewID string) error
DeleteLogicalView deletes a logical view in an instance.
func (*InstanceAdminClient) DeleteMaterializedView ¶ added in v1.36.0
func (iac *InstanceAdminClient) DeleteMaterializedView(ctx context.Context, instanceID, materializedViewID string) error
DeleteMaterializedView deletes a materialized view in an instance.
func (*InstanceAdminClient) GetAppProfile ¶
func (iac *InstanceAdminClient) GetAppProfile(ctx context.Context, instanceID, name string) (*btapb.AppProfile, error)
GetAppProfile gets information about an app profile.
func (*InstanceAdminClient) GetCluster ¶
func (iac *InstanceAdminClient) GetCluster(ctx context.Context, instanceID, clusterID string) (*ClusterInfo, error)
GetCluster fetches a cluster in an instance
func (*InstanceAdminClient) InstanceAdminClientV2 ¶ added in v1.50.0
func (iac *InstanceAdminClient) InstanceAdminClientV2() *admin.BigtableInstanceAdminClient
InstanceAdminClientV2 returns the GAPIC generated BigtableInstanceAdminClient.
The returned client shares the underlying connection pool with InstanceAdminClient. Since the connection pool is shared, calling Close on either the returned client or the parent InstanceAdminClient will close the connection pool, making both clients unusable.
func (*InstanceAdminClient) InstanceIAM ¶
func (iac *InstanceAdminClient) InstanceIAM(instanceID string) *iam.Handle
InstanceIAM returns the instance's IAM handle.
func (*InstanceAdminClient) InstanceInfo ¶
func (iac *InstanceAdminClient) InstanceInfo(ctx context.Context, instanceID string) (*InstanceInfo, error)
InstanceInfo returns information about an instance.
func (*InstanceAdminClient) Instances ¶
func (iac *InstanceAdminClient) Instances(ctx context.Context) ([]*InstanceInfo, error)
Instances returns a list of instances in the project. If any location (cluster) is unavailable due to some transient conditions, Instances returns partial results and ErrPartiallyUnavailable error with unavailable locations list.
func (*InstanceAdminClient) ListAppProfiles ¶
func (iac *InstanceAdminClient) ListAppProfiles(ctx context.Context, instanceID string) *ProfileIterator
ListAppProfiles lists information about app profiles in an instance.
func (*InstanceAdminClient) LogicalViewInfo ¶ added in v1.36.0
func (iac *InstanceAdminClient) LogicalViewInfo(ctx context.Context, instanceID, logicalViewID string) (*LogicalViewInfo, error)
LogicalViewInfo retrieves information about a logical view.