Documentation
¶
Overview ¶
Package accelerator exposes an in-process grpc.ClientConnInterface that translates Bigtable V2 RPCs into proto-native session vRPCs handled by internal/session.
Channel is scoped to one (project, instance, appProfile). It owns a session.Client and a session.TableCache, and dispatches each RPC by resolving a per-resource session.TableAPI through the cache. Handles are kept warm for reuse and evicted on idle TTL, so a long-lived daemon reclaims idle resources' session pools instead of accumulating one per resource forever. Close tears down the cache (releasing cached handles' pools) and then the session.Client.
Package accelerator implements the in-process Bigtable accelerator daemon. It hosts the gRPC server-side scaffolding — a UDS listener, lifecycle watchdogs (stdin EOF and parent-PID reparent), and proxy interceptors that forward every RPC through a Channel — alongside the Channel itself, which backs those RPCs with internal/session. The interceptor implementations live in interceptors.go alongside bigtableServerStub.
Index ¶
Constants ¶
const DataScope = "https://www.googleapis.com/auth/bigtable.data"
DataScope is the default OAuth scope the channel dials with when the caller supplies no scope override. Exported so the daemon binary can resolve ADC once with the same effective scope the channel would, then hand the resolved credentials back via option.WithCredentials (avoiding a second ADC lookup).
Variables ¶
This section is empty.
Functions ¶
func ComposeUserAgent ¶
ComposeUserAgent joins a caller-supplied user-agent prefix with the daemon's own token. Cross-language clients (e.g. the Python SDK) pass their own client user agent so the service sees both the caller and the accelerator build, e.g. "python-bigtable/2.1.0 go-acc/v1.38.0". Tokens are space-separated per the HTTP/gRPC user-agent product-token convention. An empty or blank prefix yields the daemon token alone.
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
Channel is an in-process grpc.ClientConnInterface backed by internal/session. It owns a session.Client and opens a per-resource session.TableAPI on it for each RPC. One channel per (project, instance, appProfile).
scopePrefix is "projects/<project>/instances/<instance>/", precomputed once at construction. The dispatch path validates that an incoming V2 resource name targets this daemon's scope against it, then strips it to the leaf ID session.Client expects (see resourcename.go). It is the only retained form of the (project, instance) the channel is scoped to.
sessionTables caches per-resource session.TableAPI handles keyed by the fully-qualified V2 resource name, so repeated RPCs to the same resource share one warm handle and idle resources' pools are reclaimed by its TTL sweeper.
func NewChannel ¶
func NewChannel( ctx context.Context, project, instance, appProfile, clientName string, opts ...option.ClientOption, ) (*Channel, error)
NewChannel constructs an Channel scoped to (project, instance, appProfile). It dials the underlying session.Client, which the Channel owns and closes via Close (below).
clientName is stamped as the client_name attribute on exported client-side metrics. The daemon passes its composed user agent here (see ComposeUserAgent), e.g. "python-bigtable/2.1.0 go-acc/v1.38.0", so CSM attributes the metrics to both the calling client library and the daemon build; an empty string keeps the default "go-bigtable/<version>" token.
func (*Channel) Close ¶
Close releases resources held by the channel. It closes the per-resource TableCache first — stopping its sweeper and Close()ing every cached handle so each releases its session pools — then tears down the session.Client that owns those pools.
func (*Channel) Invoke ¶
func (c *Channel) Invoke(ctx context.Context, method string, args, reply interface{}, _ ...grpc.CallOption) error
Invoke implements grpc.ClientConnInterface for unary V2 RPCs.
func (*Channel) NewStream ¶
func (c *Channel) NewStream(ctx context.Context, _ *grpc.StreamDesc, method string, _ ...grpc.CallOption) (grpc.ClientStream, error)
NewStream implements grpc.ClientConnInterface for streaming V2 RPCs. ReadRows is dispatched through session.TableAPI.ReadRow lazily: the session call is deferred until the first RecvMsg so the consumer's pull rate controls when work happens.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server manages the lifecycle of the local gRPC UDS server.
func NewServer ¶
func NewServer(udsPath string, channel *Channel, opts ...ServerOption) *Server
NewServer creates a new Server instance.
func (*Server) ShutdownChan ¶
func (s *Server) ShutdownChan() <-chan struct{}
ShutdownChan returns a read-only channel that is closed when the server shuts down. Main entrypoints block on this to know when to exit.
type ServerOption ¶
type ServerOption func(*Server)
ServerOption configures optional Server behavior. Options are applied in order by NewServer; later options override earlier ones for the same field.
func WithHandshakeTimeout ¶
func WithHandshakeTimeout(d time.Duration) ServerOption
WithHandshakeTimeout overrides how long Start waits for the parent to write the auth secret to stdin before failing. Primarily for tests that want a short deadline; the shipped daemon uses defaultHandshakeTimeout.
func WithStdinReader ¶
func WithStdinReader(r io.Reader) ServerOption
WithStdinReader overrides the reader the server treats as stdin. The shipped daemon uses the os.Stdin default; tests inject a pipe, or pass nil to disable the stdin watchdog. Providing it as a construction-time option keeps the underlying field immutable after NewServer returns.
Directories
¶
| Path | Synopsis |
|---|---|
|
Binary accelerator runs the in-process gRPC proxy daemon: it listens on a Unix domain socket, accepts standard google.bigtable.v2.Bigtable RPCs, and forwards each one through an Channel that rides the Jetstream session transport.
|
Binary accelerator runs the in-process gRPC proxy daemon: it listens on a Unix domain socket, accepts standard google.bigtable.v2.Bigtable RPCs, and forwards each one through an Channel that rides the Jetstream session transport. |