Package org.bsc.langgraph4j.checkpoint
Class AbstractMysqlServer
java.lang.Object
org.bsc.langgraph4j.checkpoint.AbstractCheckpointSaver
org.bsc.langgraph4j.checkpoint.AbstractMysqlServer
- All Implemented Interfaces:
BaseCheckpointSaver
- Direct Known Subclasses:
MysqlSaver
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classA builder for MysqlSaver.Nested classes/interfaces inherited from interface org.bsc.langgraph4j.checkpoint.BaseCheckpointSaver
BaseCheckpointSaver.Tag -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CreateOptionprotected final DataSourceprotected final com.fasterxml.jackson.databind.ObjectMapperFields inherited from interface org.bsc.langgraph4j.checkpoint.BaseCheckpointSaver
THREAD_ID_DEFAULT -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotected constructor used by the builder to create a new instance of MysqlSaver. -
Method Summary
Modifier and TypeMethodDescriptionclearCheckpointsCache(String threadId) Deprecated, for removal: This API element is subject to removal in a future version.this method do nothing because currently this saver don't use cache anymoreprotected voidInitializes the database according the create options.protected voidinsertedCheckpoint(RunnableConfig config, LinkedList<Checkpoint> checkpoints, Checkpoint checkpoint) Inserts a checkpoint to the databaseprotected LinkedList<Checkpoint>loadCheckpoints(RunnableConfig config) If the list of checkpoints is empty, loads the checkpoints from the database.protected BaseCheckpointSaver.TagreleaseCheckpoints(RunnableConfig config, LinkedList<Checkpoint> checkpoints) Marks the checkpoints as releasedprotected voidupdatedCheckpoint(RunnableConfig config, LinkedList<Checkpoint> checkpoints, Checkpoint checkpoint) If the checkpoint exists, updates the checkpoint, otherwise it inserts it.Methods inherited from class org.bsc.langgraph4j.checkpoint.AbstractCheckpointSaver
get, list, put, releaseMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.bsc.langgraph4j.checkpoint.BaseCheckpointSaver
threadId
-
Field Details
-
dataSource
-
createOption
-
objectMapper
protected final com.fasterxml.jackson.databind.ObjectMapper objectMapper
-
-
Constructor Details
-
AbstractMysqlServer
protected constructor used by the builder to create a new instance of MysqlSaver.- Parameters:
builder- Builder instance
-
-
Method Details
-
loadCheckpoints
If the list of checkpoints is empty, loads the checkpoints from the database.- Specified by:
loadCheckpointsin classAbstractCheckpointSaver- Parameters:
config- the configuration- Returns:
- a list of checkpoints
- Throws:
Exception- if an error occurs while the checkpoints are being loaded from the database.
-
insertedCheckpoint
protected void insertedCheckpoint(RunnableConfig config, LinkedList<Checkpoint> checkpoints, Checkpoint checkpoint) throws Exception Inserts a checkpoint to the database- Specified by:
insertedCheckpointin classAbstractCheckpointSaver- Parameters:
config- the configurationcheckpoints- the list of checkpointscheckpoint- the checkpoint to insert- Throws:
Exception- if an error occurs while inserting the checkpoint in the database.
-
releaseCheckpoints
protected BaseCheckpointSaver.Tag releaseCheckpoints(RunnableConfig config, LinkedList<Checkpoint> checkpoints) throws Exception Marks the checkpoints as released- Specified by:
releaseCheckpointsin classAbstractCheckpointSaver- Parameters:
config- the configurationcheckpoints- the checkpoints- Throws:
Exception- if an error occurs while marking the checkpoints as released
-
updatedCheckpoint
protected void updatedCheckpoint(RunnableConfig config, LinkedList<Checkpoint> checkpoints, Checkpoint checkpoint) throws Exception If the checkpoint exists, updates the checkpoint, otherwise it inserts it.- Specified by:
updatedCheckpointin classAbstractCheckpointSaver- Parameters:
config- the configurationcheckpoints- the list of checkpointscheckpoint- the checkpoint- Throws:
Exception- if an error occurs while inserting or updating the checkpoint.
-
initTables
protected void initTables()Initializes the database according the create options. -
clearCheckpointsCache
Deprecated, for removal: This API element is subject to removal in a future version.this method do nothing because currently this saver don't use cache anymoreRemoves the cached checkpoints associated with the given thread identifier from the in-memory cache.- Parameters:
threadId- the thread identifier whose cached checkpoints must be cleared- Returns:
- the checkpoints removed from the cache, or an empty collection if no cached checkpoints exist
-