Help us shape the future of Go! Take the 2026 Go Developer Survey

gcpbigtable

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 44 Imported by: 0

README

Cloud Bigtable

Parity grade: B · SDK cloud.google.com/go/bigtable@v1.58.0 · last audited 2026-10-25 (fa4903d9d)

Coverage

Metric Value
PARITY entries audited 43 (36 ok, 7 partial)
Feature families 7 (4 ok, 3 partial)
Known gaps 8
Deferred items 0
Resource leaks clean
Known gaps
  • Aggregate column families (value_type.aggregate_type) and the AddToCell/MergeToCell mutations are UNIMPLEMENTED.
  • Authorized views, logical views, materialized views, schema bundles, table snapshots, UndeleteTable, CopyBackup, memory layers and hot tablets are UNIMPLEMENTED; so are ReadChangeStream, GenerateInitialChangeStreamPartitions, PrepareQuery/ExecuteQuery and the session RPCs (OpenTable, GetClientConfiguration). change_stream_config is stored but no change records are produced.
  • Operations are recorded already finished: there is no CREATING state or progress, and CancelOperation has no effect.
  • Clusters share one copy of the data: replication, per-cluster storage and routing are not simulated, app profile routing is validated but does not place requests, and autoscaling never resizes a cluster.
  • App profile warnings (ignore_warnings) are never raised, and storage-type specific autoscaling storage targets, KMS key rules and node scaling factor constraints are not validated.
  • ListBackups filter and order_by, and backup hot_to_standard_time, are not supported.
  • ReadRows never splits large cell values across chunks and reports only the iteration counts in request stats; SampleRowKeys does no size-based sampling.
  • Several error codes were chosen without a production reference: unknown column family on mutate (NOT_FOUND), duplicate/missing family on ModifyColumnFamilies, unknown consistency token (INVALID_ARGUMENT), row_sample_filter outside (0, 1) and a chain or interleave of fewer than two filters are rejected as INVALID_ARGUMENT.

More

Documentation

Index

Constants

View Source
const DefaultPort = 8137

DefaultPort is the dedicated gRPC and REST listener's default TCP port.

Variables

View Source
var ErrNilAppContext = errors.New("gcpbigtable: nil app context")

ErrNilAppContext is returned when Init is called with a nil AppContext.

Functions

This section is empty.

Types

type API

type API struct {
	Instances adminpb.BigtableInstanceAdminServer
	Tables    adminpb.BigtableTableAdminServer
	// contains filtered or unexported fields
}

API groups the Bigtable services for in-process callers (dashboard proxy).

func (*API) ReadRows

func (a *API) ReadRows(req *btpb.ReadRowsRequest) ([]*btpb.Row, error)

ReadRows runs a read and returns the matching rows grouped by family and column.

type ConfigProvider

type ConfigProvider interface {
	GetGCPBigtableSettings() Settings
}

ConfigProvider extracts Bigtable configuration from the AppContext Config.

type Handler

type Handler struct {
	Backend *InMemoryBackend

	Port int
	// contains filtered or unexported fields
}

Handler serves the Cloud Bigtable admin and data APIs on a dedicated gRPC and REST listener.

func NewHandler

func NewHandler(backend *InMemoryBackend) *Handler

NewHandler creates a Handler; callers override Port from Settings.

func (*Handler) API

func (h *Handler) API() *API

API exposes the instance and table admin services plus row reads.

func (*Handler) Addr

func (h *Handler) Addr() string

Addr returns the bound listener address, or "" before StartWorker.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(*echo.Context) string

ExtractOperation is unused: requests never reach the shared router.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(*echo.Context) string

ExtractResource is unused: requests never reach the shared router.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations lists the supported gRPC methods.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns a 404 handler; the real API is on the dedicated port.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority is irrelevant because RouteMatcher never matches.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears all state.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable by delegating to the backend.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher never matches: Cloud Bigtable runs on its own listener.

func (*Handler) Shutdown

func (h *Handler) Shutdown(ctx context.Context)

Shutdown stops the listener, forcing a close after a short grace period.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable by delegating to the backend.

func (*Handler) StartWorker

func (h *Handler) StartWorker(ctx context.Context) error

StartWorker binds the dedicated listener synchronously so a port conflict is returned to the caller.

type InMemoryBackend

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

InMemoryBackend holds all Cloud Bigtable state under one lock.

func NewInMemoryBackend

func NewInMemoryBackend() *InMemoryBackend

NewInMemoryBackend creates an empty backend.

func (*InMemoryBackend) CheckAndMutateRow

CheckAndMutateRow applies one of two mutation lists depending on whether the predicate matches the row.

func (*InMemoryBackend) CheckConsistency

CheckConsistency reports whether all writes before the token reached every cluster; replication is synchronous here.

func (*InMemoryBackend) CreateAppProfile

CreateAppProfile creates an app profile.

func (*InMemoryBackend) CreateBackup

CreateBackup snapshots a table into a backup stored in a cluster.

func (*InMemoryBackend) CreateCluster

CreateCluster adds a cluster to an instance.

func (*InMemoryBackend) CreateInstance

CreateInstance creates an instance with its clusters.

func (*InMemoryBackend) CreateTable

func (b *InMemoryBackend) CreateTable(in *adminpb.CreateTableRequest) (*adminpb.Table, error)

CreateTable creates a table with its column families and split points.

func (*InMemoryBackend) DeleteAppProfile

func (b *InMemoryBackend) DeleteAppProfile(in *adminpb.DeleteAppProfileRequest) (*emptypb.Empty, error)

DeleteAppProfile deletes an app profile.

func (*InMemoryBackend) DeleteBackup

func (b *InMemoryBackend) DeleteBackup(name string) (*emptypb.Empty, error)

DeleteBackup deletes a backup.

func (*InMemoryBackend) DeleteCluster

func (b *InMemoryBackend) DeleteCluster(name string) (*emptypb.Empty, error)

DeleteCluster deletes a cluster and its backups; the last cluster of an instance cannot be deleted.

func (*InMemoryBackend) DeleteInstance

func (b *InMemoryBackend) DeleteInstance(name string) (*emptypb.Empty, error)

DeleteInstance deletes an instance and everything in it.

func (*InMemoryBackend) DeleteTable

func (b *InMemoryBackend) DeleteTable(name string) (*emptypb.Empty, error)

DeleteTable deletes a table unless it is protected.

func (*InMemoryBackend) DropRowRange

func (b *InMemoryBackend) DropRowRange(in *adminpb.DropRowRangeRequest) (*emptypb.Empty, error)

DropRowRange deletes the rows with a key prefix, or all rows.

func (*InMemoryBackend) GenerateConsistencyToken

GenerateConsistencyToken issues a token for CheckConsistency.

func (*InMemoryBackend) GetAppProfile

func (b *InMemoryBackend) GetAppProfile(name string) (*adminpb.AppProfile, error)

GetAppProfile returns an app profile.

func (*InMemoryBackend) GetBackup

func (b *InMemoryBackend) GetBackup(name string) (*adminpb.Backup, error)

GetBackup returns a backup.

func (*InMemoryBackend) GetCluster

func (b *InMemoryBackend) GetCluster(name string) (*adminpb.Cluster, error)

GetCluster returns a cluster.

func (*InMemoryBackend) GetIamPolicy

func (b *InMemoryBackend) GetIamPolicy(resource string, version int32) (*iampb.Policy, error)

GetIamPolicy returns the policy of an instance, table or backup at the requested version.

func (*InMemoryBackend) GetInstance

func (b *InMemoryBackend) GetInstance(name string) (*adminpb.Instance, error)

GetInstance returns an instance.

func (*InMemoryBackend) GetTable

GetTable returns a table in the requested view (SCHEMA_VIEW by default).

func (*InMemoryBackend) ListAppProfiles

ListAppProfiles lists the app profiles of an instance.

func (*InMemoryBackend) ListBackups

ListBackups lists the backups of a cluster, or of every cluster of an instance when the cluster is "-".

func (*InMemoryBackend) ListClusters

ListClusters lists the clusters of an instance, or of every instance in a project when the instance is "-".

func (*InMemoryBackend) ListInstances

ListInstances lists the instances of a project.

func (*InMemoryBackend) ListTables

ListTables lists the tables of an instance (NAME_ONLY by default).

func (*InMemoryBackend) ModifyColumnFamilies

func (b *InMemoryBackend) ModifyColumnFamilies(in *adminpb.ModifyColumnFamiliesRequest) (*adminpb.Table, error)

ModifyColumnFamilies creates, updates and drops column families atomically.

func (*InMemoryBackend) MutateRow

MutateRow atomically applies mutations to one row.

func (*InMemoryBackend) MutateRows

MutateRows applies each entry atomically and independently; the result holds one status per entry.

func (*InMemoryBackend) PartialUpdateCluster

PartialUpdateCluster updates the masked fields of a cluster.

func (*InMemoryBackend) PartialUpdateInstance

PartialUpdateInstance updates the masked fields of an instance.

func (*InMemoryBackend) PingAndWarm

func (b *InMemoryBackend) PingAndWarm(req *btpb.PingAndWarmRequest) error

PingAndWarm checks that the instance exists.

func (*InMemoryBackend) ReadModifyWriteRow

ReadModifyWriteRow applies append and increment rules to a row and returns the cells it wrote.

func (*InMemoryBackend) ReadRows

func (b *InMemoryBackend) ReadRows(req *btpb.ReadRowsRequest) (*ReadResult, error)

ReadRows evaluates a read: row selection, filter, reversal and the row limit.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all state.

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore loads a snapshot, replacing all state.

func (*InMemoryBackend) RestoreTable

RestoreTable creates a new table from a backup.

func (*InMemoryBackend) SampleRowKeys

SampleRowKeys returns approximate split points with the cumulative size of the rows before each.

func (*InMemoryBackend) SetIamPolicy

func (b *InMemoryBackend) SetIamPolicy(in *iampb.SetIamPolicyRequest) (*iampb.Policy, error)

SetIamPolicy replaces a policy; a stale etag aborts the call.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serialises every instance with its clusters, profiles, tables, rows, backups and operations.

func (*InMemoryBackend) TestIamPermissions

TestIamPermissions reports the requested Bigtable permissions as granted: the emulator authorises all callers.

func (*InMemoryBackend) UpdateAppProfile

UpdateAppProfile updates the masked fields of an app profile; an empty mask replaces every field.

func (*InMemoryBackend) UpdateBackup

UpdateBackup changes a backup's expiry.

func (*InMemoryBackend) UpdateCluster

func (b *InMemoryBackend) UpdateCluster(in *adminpb.Cluster) (*longrunningpb.Operation, error)

UpdateCluster changes the serve_nodes of a cluster.

func (*InMemoryBackend) UpdateInstance

func (b *InMemoryBackend) UpdateInstance(in *adminpb.Instance) (*adminpb.Instance, error)

UpdateInstance replaces an instance's display name and type.

func (*InMemoryBackend) UpdateTable

UpdateTable updates the masked table-level settings.

type Provider

type Provider struct{}

Provider implements service.Provider for Google Cloud Bigtable. It serves gRPC and REST on its own listener (see Handler.StartWorker) and never matches on the shared AWS router.

func (*Provider) Init

Init creates the backend and handler; the port is bound in StartWorker.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the service provider name.

type ReadResult

type ReadResult struct {
	Stats *btpb.ReadIterationStats
	Rows  []*ResultRow
}

ReadResult is the outcome of one ReadRows call.

type ResultRow

type ResultRow struct {
	Key   string
	Cells []fcell
}

ResultRow is one scanned row; a row the filter emptied has no cells.

type Settings

type Settings struct {
	Port int `` //nolint:lll // config struct tags are intentionally verbose
	/* 209-byte string literal not displayed */
}

Settings holds service-level configuration, embedded in the root CLI command as CLI.GCPBigtable.

func DefaultSettings

func DefaultSettings() Settings

DefaultSettings returns the settings used when no ConfigProvider is available.

Jump to

Keyboard shortcuts

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