Class PostgresSessionStoreOptions
java.lang.Object
com.google.genkit.plugins.postgresql.session.PostgresSessionStoreOptions
Configuration for
PostgresSessionStore.
The store persists all records in a single PostgreSQL table (default "genkit_sessions")
keyed by (pk, id). The pk column holds the per-tenant prefix (default
"global"); the id column discriminates snapshot, shard, and pointer records. Each row
carries a JSONB doc payload and a monotonically increasing version used for
optimistic concurrency.
The default getShardSize() is 1048576 bytes; because the store
forces a checkpoint whenever a diff would exceed the shard size, diff rows stay bounded too.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault number of turns between full checkpoints.static final longDefault subscription poll interval in milliseconds.static final intDefault shard size in bytes for checkpoint state (1 MiB).static final StringDefault table name. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a new builder.static PostgresSessionStoreOptionsdefaults()Returns default options.intReturns the number of turns between full checkpoints (default 25).longReturns the subscription poll interval in milliseconds (default 2000L).intReturns the shard size in bytes for checkpoint state (default 1048576).Returns the function that derives the per-tenant prefix from the per-request store options (defaulto -> "global").Returns the PostgreSQL table name (default "genkit_sessions").booleanReturns whether the store should create the table on first use if it does not exist (defaultfalse).
-
Field Details
-
DEFAULT_TABLE
Default table name.- See Also:
-
DEFAULT_CHECKPOINT_INTERVAL
public static final int DEFAULT_CHECKPOINT_INTERVALDefault number of turns between full checkpoints.- See Also:
-
DEFAULT_SHARD_SIZE
public static final int DEFAULT_SHARD_SIZEDefault shard size in bytes for checkpoint state (1 MiB).- See Also:
-
DEFAULT_POLL_INTERVAL_MS
public static final long DEFAULT_POLL_INTERVAL_MSDefault subscription poll interval in milliseconds.- See Also:
-
-
Method Details
-
getTableName
Returns the PostgreSQL table name (default "genkit_sessions").- Returns:
- the table name
-
getCheckpointInterval
public int getCheckpointInterval()Returns the number of turns between full checkpoints (default 25).- Returns:
- the checkpoint interval
-
getShardSize
public int getShardSize()Returns the shard size in bytes for checkpoint state (default 1048576).- Returns:
- the shard size in bytes
-
getSnapshotPathPrefix
Returns the function that derives the per-tenant prefix from the per-request store options (defaulto -> "global").- Returns:
- the prefix function
-
isCreateTableIfNotExists
public boolean isCreateTableIfNotExists()Returns whether the store should create the table on first use if it does not exist (defaultfalse).- Returns:
trueif the table should be created when missing
-
getPollIntervalMs
public long getPollIntervalMs()Returns the subscription poll interval in milliseconds (default 2000L).- Returns:
- the poll interval in milliseconds
-
defaults
Returns default options.- Returns:
- a
PostgresSessionStoreOptionswith all defaults
-
builder
Creates a new builder.- Returns:
- a new builder
-