session

package
v1.51.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package session hosts the vRPC-over-session data-plane API surface for the bigtable Go client. The interfaces defined here describe a proto-native alternative to the classic gRPC TableAPI: methods take and return *SessionReadRow{Request,Response} / *SessionMutateRow{Request,Response} instead of bigtable.Row.

This file establishes the shape only; implementations land in follow-up changes. Nothing in this package imports the top-level bigtable package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// OpenSessionTable returns a TableAPI for a standard table,
	// identified by the leaf table name (e.g. "my-table"). Full
	// resource composition happens inside the implementation.
	OpenSessionTable(tableName string) TableAPI

	// OpenAuthorizedView returns a TableAPI for a specific
	// authorized view under table.
	OpenAuthorizedView(table, view string) TableAPI

	// OpenMaterializedView returns a read-only TableAPI for a
	// materialized view. MutateRow on the returned handle errors.
	OpenMaterializedView(view string) TableAPI

	// MeterProvider exposes the OpenTelemetry meter provider the
	// Client was constructed with — same instance the bigtable
	// client uses for its own metrics, so callers can register
	// additional instruments against the same provider.
	MeterProvider() metric.MeterProvider

	// AddSessionLoadListener registers a listener invoked every time
	// the server-driven client configuration reports a new
	// session-load ratio (0.0 = classic-only, 1.0 = session-only).
	// Returns an unregister thunk.
	AddSessionLoadListener(func(load float64)) func()

	// Close closes the underlying channel pool.
	//
	// Callers should close every vended TableAPI first — this
	// tears down the shared channel pool, and vended tables can no
	// longer issue cleanup RPCs (e.g., session deletion) once the pool
	// is gone. Any TableAPI still open at the time of this call
	// becomes unusable.
	Close() error
}

Client owns the underlying gRPC channel pool + stub and vends per-resource TableAPI instances. Does NOT cache — callers are responsible for caching per-resource entries so repeat Opens reuse the same underlying pools.

type Invoker

type Invoker interface {
	Invoke(ctx context.Context, desc btransport.VRpcDescriptor, req interface{}) (btransport.InvokeResult, error)
}

Invoker is the narrow surface sessionTable needs from a session pool: dispatch a single virtual RPC and surface the full InvokeResult (response, cluster info, server-side Stats, and the local SentAt timestamp). Satisfied by *btransport.SessionPoolImpl; the interface exists so tests can substitute a fake without standing up a real pool.

type TableAPI

type TableAPI interface {
	ReadRow(ctx context.Context, req *btpb.SessionReadRowRequest) (*btpb.SessionReadRowResponse, error)
	MutateRow(ctx context.Context, req *btpb.SessionMutateRowRequest) (*btpb.SessionMutateRowResponse, error)

	// Close releases this resource's underlying read + write session
	// pools. Independent from Client.Close — closing a single
	// resource does not close the shared channel pool.
	Close() error
}

TableAPI is the per-resource, proto-native data-plane API. Implementations route ReadRow over a read session pool and MutateRow over a separate write session pool; callers do not see the distinction. Pools open lazily on first call, so a resource that only ever reads never pays for a write pool.

Jump to

Keyboard shortcuts

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