store

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRoomNotFound = errors.New("room not found")

ErrRoomNotFound indicates that the requested room was not found.

Functions

This section is empty.

Types

type Room

type Room struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	Password  []byte    `json:"password"`
	CreatedAt time.Time `json:"created_at"`
}

Room represents the properties of a room in the store.

type Sess

type Sess struct {
	ID     string `json:"id"`
	Handle string `json:"name"`
}

Sess represents an authenticated peer session.

type Store

type Store interface {
	AddRoom(r Room, ttl time.Duration) error
	GetRoom(id string) (Room, error)
	ExtendRoomTTL(id string, ttl time.Duration) error
	RoomExists(id string) (bool, error)
	RemoveRoom(id string) error

	AddSession(sessID, handle, roomID string, ttl time.Duration) error
	GetSession(sessID, roomID string) (Sess, error)
	RemoveSession(sessID, roomID string) error
	ClearSessions(roomID string) error

	Get(key string) ([]byte, error)
	Set(key string, value []byte) error
}

Store represents a backend store.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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