Pkg.go.dev is a new destination for Go discovery & docs. Check it out at pkg.go.dev/cloud.google.com/go/bigtable and share your feedback.

Redirected from google.golang.org/cloud/bigtable.

package bigtable

import "cloud.google.com/go/bigtable"

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.

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.

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.

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.

admin.go bigtable.go doc.go filter.go gc.go reader.go

❖ 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 ( // 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" // 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.

GCRuleToString converts the given GcRule proto to a user-visible string.

❖ type AdminClient struct { // contains filtered or unexported fields }

AdminClient is a client type for performing admin operations within a specific instance.

❖ 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 (ac *AdminClient) BackupInfo(ctx context.Context, cluster, backup string) (*BackupInfo, error)

BackupInfo gets backup metadata.

❖ 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.

Close closes the AdminClient.

❖ 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 (ac *AdminClient) CreateColumnFamily(ctx context.Context, table, family string) error

CreateColumnFamily creates a new column family in a table.

❖ 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 (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 (ac *AdminClient) CreateTableFromConf(ctx context.Context, conf *TableConf) error

CreateTableFromConf creates a new table in the instance from the given configuration.

❖ 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 (ac *AdminClient) DeleteBackup(ctx context.Context, cluster, backup string) error

DeleteBackup deletes a backup in a cluster.

❖ 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 (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 (ac *AdminClient) DeleteTable(ctx context.Context, table string) error

DeleteTable deletes a table and all of its data.

❖ func (ac *AdminClient) DropAllRows(ctx context.Context, table string) error

DropAllRows permanently deletes all rows from the specified table.

❖ func (ac *AdminClient) DropRowRange(ctx context.Context, table, rowKeyPrefix string) error

DropRowRange permanently deletes a row range from the specified table.

❖ 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.

❖ 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 (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 (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 (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.

TableIAM creates an IAM client specific to a given Instance and Table within the configured project.

❖ func (ac *AdminClient) TableInfo(ctx context.Context, table string) (*TableInfo, error)

TableInfo retrieves information about a table.

Tables returns a list of the tables in the instance.

❖ 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 (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 ApplyOption interface { // contains filtered or unexported methods }

An ApplyOption is an optional argument to Apply.

GetCondMutationResult returns an ApplyOption that reports whether the conditional mutation's condition matched.

❖ type BackupInfo struct { Name string SourceTable string SizeBytes int64 StartTime time.Time EndTime time.Time ExpireTime time.Time State string }

BackupInfo contains backup metadata. This struct is read-only.

❖ type BackupIterator struct { // contains filtered or unexported fields }

BackupIterator is an EntryIterator that iterates over log entries.

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.

PageInfo supports pagination. See https://godoc.org/google.golang.org/api/iterator package for details.

❖ 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(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(ctx context.Context, project, instance string, config ClientConfig, opts ...option.ClientOption) (*Client, error)

NewClientWithConfig creates a new client with the given config.

Close closes the Client.

Open opens a table.

❖ 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 }

ClientConfig has configurations for the client.

❖ type ClusterConfig struct { InstanceID , ClusterID , Zone string NumNodes int32 StorageType StorageType }

ClusterConfig contains the information necessary to create a cluster

❖ type ClusterInfo struct { Name string // name of the cluster Zone string // GCP zone of the cluster (e.g. "us-central1-a") ServeNodes int // number of allocated serve nodes State string // state of the cluster StorageType StorageType // the storage type of the cluster }

ClusterInfo represents information about a cluster.

❖ type ErrPartiallyUnavailable struct { Locations []string // unavailable locations }

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.

❖ type FamilyInfo struct { Name string GCPolicy string }

FamilyInfo represents information about a column family.

❖ type Filter interface { String () string // contains filtered or unexported methods }

A Filter represents a row filter.

BlockAllFilter returns a filter that matches nothing.

CellsPerRowLimitFilter returns a filter that matches only the first N cells of each row.

CellsPerRowOffsetFilter returns a filter that skips the first N cells of each row, matching all subsequent cells.

ChainFilters returns a filter that applies a sequence of filters.

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(family, start, end string) Filter

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(predicateFilter, trueFilter, falseFilter Filter) Filter

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.

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.

InterleaveFilters returns a filter that applies a set of filters in parallel and interleaves the results.

LabelFilter returns a filter that applies the given label to all cells in the output row.

LatestNFilter returns a filter that matches the most recent N cells in each column.

PassAllFilter returns a filter that matches everything.

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.

RowSampleFilter returns a filter that matches a row with a probability of p (must be in the interval (0, 1)).

StripValueFilter returns a filter that replaces each value with the empty string.

❖ func TimestampRangeFilter(startTime time.Time, endTime time.Time) Filter

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(startTime Timestamp, endTime Timestamp) Filter

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.

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(start, end []byte) Filter

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 GCPolicy interface { String () string // contains filtered or unexported methods }

A GCPolicy represents a rule that determines which cells are eligible for garbage collection.

IntersectionPolicy returns a GC policy that only applies when all its sub-policies apply.

MaxAgePolicy returns a GC policy that applies to all cells older than the given age.

MaxVersionsPolicy returns a GC policy that applies to all versions of a cell except for the most recent n.

NoGcPolicy applies to all cells setting maxage and maxversions to nil implies no gc policies

UnionPolicy returns a GC policy that applies when any of its sub-policies apply.

❖ 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(ctx context.Context, project string, opts ...option.ClientOption) (*InstanceAdminClient, error)

NewInstanceAdminClient creates a new InstanceAdminClient for a given project.

Close closes the InstanceAdminClient.

❖ func (iac *InstanceAdminClient) Clusters(ctx context.Context, instanceID string) ([]*ClusterInfo, error)

Clusters lists the clusters in an instance.

❖ func (iac *InstanceAdminClient) CreateAppProfile(ctx context.Context, profile ProfileConf) (*btapb.AppProfile, error)

CreateAppProfile creates an app profile within an instance.

❖ 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 (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 (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 (iac *InstanceAdminClient) DeleteAppProfile(ctx context.Context, instanceID, name string) error

DeleteAppProfile deletes an app profile from an instance.

❖ func (iac *InstanceAdminClient) DeleteCluster(ctx context.Context, instanceID, clusterID string) error

DeleteCluster deletes a cluster from an instance.

❖ func (iac *InstanceAdminClient) DeleteInstance(ctx context.Context, instanceID string) error

DeleteInstance deletes an instance from the project.

❖ func (iac *InstanceAdminClient) GetAppProfile(ctx context.Context, instanceID, name string) (*btapb.AppProfile, error)

GetAppProfile gets information about an app profile.

❖ func (iac *InstanceAdminClient) GetCluster(ctx context.Context, instanceID, clusterID string) (*ClusterInfo, error)

GetCluster fetches a cluster in an instance

InstanceIAM returns the instance's IAM handle.

❖ func (iac *InstanceAdminClient) InstanceInfo(ctx context.Context, instanceID string) (*InstanceInfo, error)

InstanceInfo returns information about an instance.

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 (iac *InstanceAdminClient) ListAppProfiles(ctx context.Context, instanceID string) *ProfileIterator

ListAppProfiles lists information about app profiles in an instance.

❖ func (iac *InstanceAdminClient) UpdateAppProfile(ctx context.Context, instanceID, profileID string, updateAttrs ProfileAttrsToUpdate) error

UpdateAppProfile updates an app profile within an instance. updateAttrs should be set. If unset, all fields will be replaced.

❖ func (iac *InstanceAdminClient) UpdateCluster(ctx context.Context, instanceID, clusterID string, serveNodes int32) error

UpdateCluster updates attributes of a cluster

❖ func (iac *InstanceAdminClient) UpdateInstanceWithClusters(ctx context.Context, conf *InstanceWithClustersConfig) error

UpdateInstanceWithClusters updates an instance and its clusters. Updateable fields are instance display name, instance type and cluster size. The provided InstanceWithClustersConfig is used as follows: - InstanceID is required - DisplayName and InstanceType are updated only if they are not empty - ClusterID is required for any provided cluster - All other cluster fields are ignored except for NumNodes, which if set will be updated

This method may return an error after partially succeeding, for example if the instance is updated but a cluster update fails. If an error is returned, InstanceInfo and Clusters may be called to determine the current state.

❖ type InstanceConf struct { InstanceId , DisplayName , ClusterId , Zone string // NumNodes must not be specified for DEVELOPMENT instance types NumNodes int32 StorageType StorageType InstanceType InstanceType Labels map[string]string }

InstanceConf contains the information necessary to create an Instance

❖ type InstanceInfo struct { Name string // name of the instance DisplayName string // display name for UIs InstanceState InstanceState InstanceType InstanceType Labels map[string]string }

InstanceInfo represents information about an instance

❖ type InstanceState int32

InstanceState is the state of the instance. This is output-only.

❖ type InstanceType int32

InstanceType is the type of the instance.

❖ type InstanceWithClustersConfig struct { InstanceID , DisplayName string Clusters []ClusterConfig InstanceType InstanceType Labels map[string]string }

InstanceWithClustersConfig contains the information necessary to create an Instance

❖ type Mutation struct { // contains filtered or unexported fields }

Mutation represents a set of changes for a single row of a table.

❖ func NewCondMutation(cond Filter, mtrue, mfalse *Mutation) *Mutation

NewCondMutation returns a conditional mutation. The given row filter determines which mutation is applied: If the filter matches any cell in the row, mtrue is applied; otherwise, mfalse is applied. Either given mutation may be nil.

The application of a ReadModifyWrite is atomic; concurrent ReadModifyWrites will be executed serially by the server.

NewMutation returns a new mutation.

❖ func (m *Mutation) DeleteCellsInColumn(family, column string)

DeleteCellsInColumn will delete all the cells whose columns are family:column.

DeleteCellsInFamily will delete all the cells whose columns are family:*.

DeleteRow deletes the entire row.

❖ func (m *Mutation) DeleteTimestampRange(family, column string, start, end Timestamp)

DeleteTimestampRange deletes all cells whose columns are family:column and whose timestamps are in the half-open interval [start, end). If end is zero, it will be interpreted as infinity. The timestamps will be truncated to millisecond granularity.

❖ func (m *Mutation) Set(family, column string, ts Timestamp, value []byte)

Set sets a value in a specified column, with the given timestamp. The timestamp will be truncated to millisecond granularity. A timestamp of ServerTime means to use the server timestamp.

❖ type ProfileAttrsToUpdate struct { // If set, updates the description. optional.String //If set, updates the routing policy. optional.String //If RoutingPolicy is updated to SingleClusterRouting, set these fields as well. string bool // If true, warnings are ignored bool }

ProfileAttrsToUpdate define addrs to update during an Update call. If unset, no fields will be replaced.

GetFieldMaskPath returns the field mask path.

❖ type ProfileConf struct { Name string ProfileID string InstanceID string Etag string Description string RoutingPolicy string ClusterID string AllowTransactionalWrites bool // If true, warnings are ignored IgnoreWarnings bool }

ProfileConf contains the information necessary to create an profile

❖ type ProfileIterator struct { // contains filtered or unexported fields }

ProfileIterator iterates over profiles.

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.

PageInfo supports pagination. See https://godoc.org/google.golang.org/api/iterator package for details.

❖ type ReadItem struct { Row , Column string Timestamp Value []byte Labels []string }

A ReadItem is returned by Read. A ReadItem contains data from a specific row and column.

❖ type ReadModifyWrite struct { // contains filtered or unexported fields }

ReadModifyWrite represents a set of operations on a single row of a table. It is like Mutation but for non-idempotent changes. When applied, these operations operate on the latest values of the row's cells, and result in a new value being written to the relevant cell with a timestamp that is max(existing timestamp, current server time).

The application of a ReadModifyWrite is atomic; concurrent ReadModifyWrites will be executed serially by the server.

NewReadModifyWrite returns a new ReadModifyWrite.

❖ func (m *ReadModifyWrite) AppendValue(family, column string, v []byte)

AppendValue appends a value to a specific cell's value. If the cell is unset, it will be treated as an empty value.

❖ func (m *ReadModifyWrite) Increment(family, column string, delta int64)

Increment interprets the value in a specific cell as a 64-bit big-endian signed integer, and adds a value to it. If the cell is unset, it will be treated as zero. If the cell is set and is not an 8-byte value, the entire ApplyReadModifyWrite operation will fail.

❖ type ReadOption interface { // contains filtered or unexported methods }

A ReadOption is an optional argument to ReadRows.

LimitRows returns a ReadOption that will limit the number of rows to be read.

RowFilter returns a ReadOption that applies f to the contents of read rows.

If multiple RowFilters are provided, only the last is used. To combine filters, use ChainFilters or InterleaveFilters instead.

❖ type Row map[string][]ReadItem

A Row is returned by ReadRows. The map is keyed by column family (the prefix of the column name before the colon). The values are the returned ReadItems for that column family in the order returned by Read.

Key returns the row's key, or "" if the row is empty.

❖ type RowList []string

RowList is a sequence of row keys.

❖ type RowRange struct { // contains filtered or unexported fields }

A RowRange is a half-open interval [Start, Limit) encompassing all the rows with keys at least as large as Start, and less than Limit. (Bigtable string comparison is the same as Go's.) A RowRange can be unbounded, encompassing all keys at least as large as Start.

InfiniteRange returns the RowRange consisting of all keys at least as large as start.

❖ func NewRange(begin, end string) RowRange

NewRange returns the new RowRange [begin, end).

PrefixRange returns a RowRange consisting of all keys starting with the prefix.

Contains says whether the RowRange contains the key.

String provides a printable description of a RowRange.

Unbounded tests whether a RowRange is unbounded.

❖ type RowRangeList []RowRange

RowRangeList is a sequence of RowRanges representing the union of the ranges.

❖ type RowSet interface { // contains filtered or unexported methods }

RowSet is a set of rows to be read. It is satisfied by RowList, RowRange and RowRangeList. The serialized size of the RowSet must be no larger than 1MiB.

SingleRow returns a RowSet for reading a single row.

❖ type SnapshotInfo struct { Name string SourceTable string DataSize int64 CreateTime time.Time DeleteTime time.Time }

SnapshotInfo contains snapshot metadata.

❖ type SnapshotIterator struct { // contains filtered or unexported fields }

SnapshotIterator is an EntryIterator that iterates over log entries.

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.

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.

PageInfo supports pagination. See https://godoc.org/google.golang.org/api/iterator package for details.

❖ type StorageType int

StorageType is the type of storage used for all tables in an instance

❖ const ( SSD StorageType = iota HDD )

❖ type Table struct { // contains filtered or unexported fields }

A Table refers to a table.

A Table is safe to use concurrently.

❖ func (t *Table) Apply(ctx context.Context, row string, m *Mutation, opts ...ApplyOption) (err error)

Apply mutates a row atomically. A mutation must contain at least one operation and at most 100000 operations.

❖ func (t *Table) ApplyBulk(ctx context.Context, rowKeys []string, muts []*Mutation, opts ...ApplyOption) (errs []error, err error)

ApplyBulk applies multiple Mutations, up to a maximum of 100,000. Each mutation is individually applied atomically, but the set of mutations may be applied in any order.

Two types of failures may occur. If the entire process fails, (nil, err) will be returned. If specific mutations fail to apply, ([]err, nil) will be returned, and the errors will correspond to the relevant rowKeys/muts arguments.

Conditional mutations cannot be applied in bulk and providing one will result in an error.

❖ func (t *Table) ApplyReadModifyWrite(ctx context.Context, row string, m *ReadModifyWrite) (Row, error)

ApplyReadModifyWrite applies a ReadModifyWrite to a specific row. It returns the newly written cells.

❖ func (t *Table) ReadRow(ctx context.Context, row string, opts ...ReadOption) (Row, error)

ReadRow is a convenience implementation of a single-row reader. A missing row will return a zero-length map and a nil error.

❖ func (t *Table) ReadRows(ctx context.Context, arg RowSet, f func(Row) bool, opts ...ReadOption) (err error)

ReadRows reads rows from a table. f is called for each row. If f returns false, the stream is shut down and ReadRows returns. f owns its argument, and f is called serially in order by row key.

By default, the yielded rows will contain all values in all cells. Use RowFilter to limit the cells returned.

SampleRowKeys returns a sample of row keys in the table. The returned row keys will delimit contiguous sections of the table of approximately equal size, which can be used to break up the data for distributed tasks like mapreduces.

❖ type TableConf struct { TableID string SplitKeys []string // Families is a map from family name to GCPolicy Families map[string]GCPolicy }

TableConf contains all of the information necessary to create a table with column families.

❖ type TableInfo struct { // DEPRECATED - This field is deprecated. Please use FamilyInfos instead. Families []string FamilyInfos []FamilyInfo }

TableInfo represents information about a table.

❖ type Timestamp int64

Timestamp is in units of microseconds since 1 January 1970.

❖ const ServerTime Timestamp = -1

ServerTime is a specific Timestamp that may be passed to (*Mutation).Set. It indicates that the server's timestamp should be used.

Now returns the Timestamp representation of the current time on the client.

Time converts a time.Time into a Timestamp.

Time converts a Timestamp into a time.Time.

TruncateToMilliseconds truncates a Timestamp to millisecond granularity, which is currently the only granularity supported.

❖ type UpdateInstanceResults struct { bool []string []string []string }

UpdateInstanceResults contains information about the changes made after invoking UpdateInstanceAndSyncClusters.

❖ func UpdateInstanceAndSyncClusters(ctx context.Context, iac *InstanceAdminClient, conf *InstanceWithClustersConfig) (*UpdateInstanceResults, error)

UpdateInstanceAndSyncClusters updates an instance and its clusters, and will synchronize the clusters in the instance with the provided clusters, creating and deleting them as necessary. The provided InstanceWithClustersConfig is used as follows: - InstanceID is required - DisplayName and InstanceType are updated only if they are not empty - ClusterID is required for any provided cluster - Any cluster present in conf.Clusters but not part of the instance will be created using CreateCluster

and the given ClusterConfig.

- Any cluster missing from conf.Clusters but present in the instance will be removed from the instance

using DeleteCluster.

- Any cluster in conf.Clusters that also exists in the instance will be updated to contain the

provided number of nodes if set.

This method may return an error after partially succeeding, for example if the instance is updated but a cluster update fails. If an error is returned, InstanceInfo and Clusters may be called to determine the current state. The return UpdateInstanceResults will describe the work done by the method, whether partial or complete.

Path Synopsis bttest Package bttest contains test helpers for working with the bigtable package. cmd/cbt The `cbt` tool is a command-line tool that allows you to interact with Cloud Bigtable. cmd/emulator cbtemulator launches the in-memory Cloud Bigtable server on the given address. cmd/loadtest Loadtest does some load testing through the Go client library for Cloud Bigtable. cmd/scantest Scantest does scan-related load testing against Cloud Bigtable. internal/cbtconfig Package cbtconfig encapsulates common code for reading configuration from .cbtrc and gcloud. internal/conformance internal/mockserver internal/option Package option contains common code for dealing with client options. internal/stat