Learn R Programming

aisdk (version 1.1.0)

FileChannelSessionStore: File Channel Session Store

Description

File-backed session store for external messaging channels.

Arguments

Super class

aisdk::ChannelSessionStore -> FileChannelSessionStore

Public fields

base_dir

Base directory for persisted channel sessions.

Methods


Method new()

Initialize a file-backed channel session store.

Usage

FileChannelSessionStore$new(base_dir)

Arguments

base_dir

Base directory for store files.


Method get_session_path()

Get the on-disk session file path for a key.

Usage

FileChannelSessionStore$get_session_path(session_key)

Arguments

session_key

Session key.

Returns

Absolute file path.


Method get_index_path()

Get the channel index path.

Usage

FileChannelSessionStore$get_index_path()

Returns

Absolute file path.


Method list_sessions()

List all session records.

Usage

FileChannelSessionStore$list_sessions()

Returns

Named list of session records.


Method has_processed_event()

Check whether an event id has already been processed.

Usage

FileChannelSessionStore$has_processed_event(channel_id, event_id)

Arguments

channel_id

Channel identifier.

event_id

Event identifier.

Returns

Logical scalar.


Method mark_processed_event()

Mark an event id as processed.

Usage

FileChannelSessionStore$mark_processed_event(
  channel_id,
  event_id,
  payload = NULL
)

Arguments

channel_id

Channel identifier.

event_id

Event identifier.

payload

Optional event payload to keep in the dedupe index.

Returns

Invisible stored event record.


Method get_record()

Get a single session record.

Usage

FileChannelSessionStore$get_record(session_key)

Arguments

session_key

Session key.

Returns

Session record or NULL.


Method load_session()

Load a persisted ChatSession.

Usage

FileChannelSessionStore$load_session(
  session_key,
  tools = NULL,
  hooks = NULL,
  registry = NULL
)

Arguments

session_key

Session key.

tools

Optional tools to reattach.

hooks

Optional hooks to reattach.

registry

Optional provider registry.

Returns

A ChatSession or NULL if no persisted state exists.


Method save_session()

Save a ChatSession and update the local index.

Usage

FileChannelSessionStore$save_session(session_key, session, record = NULL)

Arguments

session_key

Session key.

session

ChatSession instance.

record

Optional record fields to merge into the index.

Returns

Invisible normalized record.


Method update_record()

Update a record without saving a session file.

Usage

FileChannelSessionStore$update_record(session_key, record)

Arguments

session_key

Session key.

record

Record fields to merge.

Returns

Invisible updated record.


Arguments

parent_session_key

Parent session key.

child_session_key

Child session key.

Returns

Invisible updated parent record.


Method clone()

The objects of this class are cloneable with this method.

Usage

FileChannelSessionStore$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.