Class DatabaseDestination

java.lang.Object
io.github.flink.gcp.connector.firestore.DatabaseDestination
All Implemented Interfaces:
Serializable

@PublicEvolving public final class DatabaseDestination extends Object implements Serializable
A Firestore database in Native mode: a project and a database id.

A database, not a collection, is as far as the sink's destination goes: every write names its own document path, and collections are implicit in Firestore — the first write into one creates it. That is why the sink takes no destination resolver and has nothing to create.

Instances are pure database identity: equals(Object) and hashCode() are defined over exactly (project, database id). How the client reaches the database — an emulator endpoint, a service-account key — belongs to the direction that takes it.

This type sits at the module root rather than under sink because the later source and table directions take the same value.

Instances are immutable and cheap to reuse.

See Also:
  • Field Details

    • DEFAULT_DATABASE_ID

      public static final String DEFAULT_DATABASE_ID
      The id of the database every project is created with.
      See Also:
  • Method Details

    • of

      public static DatabaseDestination of(String project)
      Creates a reference to a project's "(default)" database.
      Parameters:
      project - the Google Cloud project id, as a bare id rather than a resource path
      Returns:
      the database reference
      Throws:
      IllegalArgumentException - if the project is null or blank, has leading or trailing whitespace, or contains '/' — a separator would make the composed resource path address a different resource
    • of

      public static DatabaseDestination of(String project, String databaseId)
      Creates a reference to a named database.
      Parameters:
      project - the Google Cloud project id, as a bare id rather than a resource path
      databaseId - the database id, for example "(default)"
      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

      public String getProject()
      Returns the Google Cloud project id.
    • getDatabaseId

      public String getDatabaseId()
      Returns the database id.
    • toString

      public String toString()
      Returns the database as the resource name Firestore itself uses, projects/P/databases/D.
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object