Class DatabaseDestination
- All Implemented Interfaces:
Serializable
The instance is part of the identity because a database id is unique only within one instance, and a project may hold several instances.
A database, not a table, is as far as the sink's destination goes: a Mutation names
the table it applies to, so one sink writes to as many tables as its serializer produces. The
other sinks of this project take a destination resolver for that; here the mutation already
carries the answer, which is why there is none — and why the mutation-cell weights are read for
the whole database rather than for one table.
Instances are pure database identity: equals(Object) and hashCode()
are defined over exactly (project, instance, database). Nothing about how the client reaches the
database — the emulator endpoint, the RPC priority — belongs here; those are options of the
direction that takes them, because they choose a path to the data rather than the data's address.
This type sits at the module root rather than under sink because both source APIs take
the same value.
Instances are immutable and cheap to reuse.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the Spanner database id, given as a bare id rather than a resource path.Returns the Spanner instance id, given as a bare id rather than a resource path.Returns the Google Cloud project id, given as a bare id rather than a resource path.inthashCode()static DatabaseDestinationCreates aDatabaseDestinationfrom bare ids, not resource paths.toString()Returns the database as the resource name Spanner itself uses,projects/P/instances/I/databases/D.
-
Method Details
-
of
Creates aDatabaseDestinationfrom bare ids, not resource paths.- Parameters:
project- the Google Cloud project idinstance- the Spanner instance iddatabase- the Spanner database id- Returns:
- the database reference
- Throws:
IllegalArgumentException- if a component is null or blank, has leading or trailing whitespace, or contains'/'— a separator would make the composed resource path address a different resource
-
getProject
Returns the Google Cloud project id, given as a bare id rather than a resource path. -
getInstance
Returns the Spanner instance id, given as a bare id rather than a resource path. -
getDatabase
Returns the Spanner database id, given as a bare id rather than a resource path. -
toString
Returns the database as the resource name Spanner itself uses,projects/P/instances/I/databases/D. -
equals
-
hashCode
public int hashCode()
-