Class MongoSessionStoreOptions
java.lang.Object
com.google.genkit.plugins.mongodb.session.MongoSessionStoreOptions
Configuration for
MongoSessionStore.
The store persists all records in a single MongoDB collection (default database "genkit", collection "genkit_sessions"). Each document's _id
combines the per-tenant prefix (default "global") with the record id; the record kind is
discriminated by the id. Each document carries a version field used for optimistic
concurrency.
The default getShardSize() is 1048576 bytes, kept safely under
MongoDB's 16 MB document-size limit; because the store forces a checkpoint whenever a diff
would exceed the shard size, diff documents stay bounded too.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault number of turns between full checkpoints.static final StringDefault collection name.static final StringDefault database name.static final longDefault subscription poll interval in milliseconds.static final intDefault shard size in bytes for checkpoint state (1 MiB, under the 16 MB document cap). -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a new builder.static MongoSessionStoreOptionsdefaults()Returns default options.intReturns the number of turns between full checkpoints (default 25).Returns the MongoDB collection name (default "genkit_sessions").Returns the MongoDB database name (default "genkit").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").
-
Field Details
-
DEFAULT_DATABASE
Default database name.- See Also:
-
DEFAULT_COLLECTION
Default collection 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, under the 16 MB document cap).- See Also:
-
DEFAULT_POLL_INTERVAL_MS
public static final long DEFAULT_POLL_INTERVAL_MSDefault subscription poll interval in milliseconds.- See Also:
-
-
Method Details
-
getDatabaseName
Returns the MongoDB database name (default "genkit").- Returns:
- the database name
-
getCollectionName
Returns the MongoDB collection name (default "genkit_sessions").- Returns:
- the collection 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
-
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
MongoSessionStoreOptionswith all defaults
-
builder
Creates a new builder.- Returns:
- a new builder
-