storage

package
v0.12.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package storage provides ability to transfer sessions user data to/from memory/disk storage

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONSessionStorage

type JSONSessionStorage struct {
	// contains filtered or unexported fields
}

JSONSessionStorage stores user session in file in json format.

func NewJSONSessionData

func NewJSONSessionData(filePath string) *JSONSessionStorage

NewJSONSessionData creates new storage.

func (*JSONSessionStorage) GetUsers

func (ss *JSONSessionStorage) GetUsers(communicationType string, channelID string) usermanager.UserList

GetUsers returns UserList for given message processor.

func (*JSONSessionStorage) Load

func (ss *JSONSessionStorage) Load() error

Load reads sessions data from disk.

func (*JSONSessionStorage) Save

func (ss *JSONSessionStorage) Save() error

Save writes sessions data to disk.

func (*JSONSessionStorage) SetUsers

func (ss *JSONSessionStorage) SetUsers(communicationType string, channelID string, users usermanager.UserList)

SetUsers sets UserList for given message processor.

type PersistentSessionStorage

type PersistentSessionStorage interface {
	Load() error
	Save() error

	SessionStorage
}

PersistentSessionStorage allows to dump data from memory to some persistent storage.

type SessionStorage

type SessionStorage interface {
	GetUsers(communicationType string, channelID string) usermanager.UserList
	SetUsers(communicationType string, channelID string, users usermanager.UserList)
}

SessionStorage getters and setters for users data.

Jump to

Keyboard shortcuts

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