protocol

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package protocol defines interfaces

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryStore

type MemoryStore interface {

	// PutSession insert (overwrite) a session
	PutSession(session *model.Session) error

	// UpdateSession update a session
	UpdateSession(session *model.Session) error

	// DeleteSession delete a session
	DeleteSession(userID, sessionID string) error

	// DeleteSessions delete all sessions for a user
	DeleteSessions(userID string) (int, error)

	// DeleteSessionAndMessages delete a session and its messages
	DeleteSessionAndMessages(userID, sessionID string) error

	// DeleteAllSessions delete all sessions for all users
	DeleteAllSessions() (int, error)

	// GetSession get a session
	GetSession(session *model.Session) error

	// ListAllSessions list all sessions
	ListAllSessions() <-chan model.Session

	// ListSessions list sessions for a specific user
	ListSessions(
		userID string,
		filter tablestore.ColumnFilter,
		maxCount int,
		batchSize int,
	) <-chan model.Session

	// ListRecentSessions list recent sessions sorted by update time
	ListRecentSessions(
		userID string,
		filter tablestore.ColumnFilter,
		inclusiveStartUpdateTime int64,
		inclusiveEndUpdateTime int64,
		maxCount int,
		batchSize int,
	) ([]model.Session, error)

	// ListRecentSessionsPaginated paginated recent sessions
	ListRecentSessionsPaginated(
		userID string,
		filter tablestore.ColumnFilter,
		inclusiveStartUpdateTime int64,
		inclusiveEndUpdateTime int64,
		pageSize int,
		nextStartPrimaryKey *tablestore.PrimaryKey,
	) (*model.Response[model.Session], error)

	SearchSessions(
		userID string,
		keyword string,
		inclusiveStartUpdateTime int64,
		inclusiveEndUpdateTime int64,
		pageSize int32,
		nextToken []byte,
	) (*model.Response[model.Session], error)

	// PutMessage insert (overwrite) a message
	PutMessage(message *model.Message) error

	// UpdateMessage update a message
	UpdateMessage(message *model.Message) error

	// DeleteMessage delete a message
	DeleteMessage(sessionID string, messageID string, createTime int64) error

	// DeleteMessages delete all messages for a session
	DeleteMessages(sessionID string) (int, error)

	// DeleteAllMessages delete all messages
	DeleteAllMessages() (int, error)

	// GetMessage get a message
	GetMessage(message *model.Message) error

	// ListAllMessages list all messages
	ListAllMessages() <-chan model.Message

	// ListMessages list messages for a session
	ListMessages(sessionID string) <-chan model.Message

	// ListMessagesWithFilter  list messages with filters
	ListMessagesWithFilter(
		sessionID string,
		filter tablestore.ColumnFilter,
		inclusiveStartCreateTime int64,
		inclusiveEndCreateTime int64,
		order tablestore.Direction,
		maxCount int,
		batchSize int,
	) <-chan model.Message

	// ListMessagesPaginated  paginated messages
	ListMessagesPaginated(
		sessionID string,
		filter tablestore.ColumnFilter,
		inclusiveStartCreateTime int64,
		inclusiveEndCreateTime int64,
		order tablestore.Direction,
		pageSize int,
		nextStartPrimaryKey *tablestore.PrimaryKey,
	) (*model.Response[model.Message], error)

	SearchMessages(
		sessionID string,
		keyword string,
		inclusiveStartCreateTime int64,
		inclusiveEndCreateTime int64,
		pageSize int32,
		nextToken []byte,
	) (*model.Response[model.Message], error)

	// InitTable initialize table
	InitTable() error
}

MemoryStore defines the interface for session and message persistence.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL