storage

package
v0.0.0-...-d2b5f66 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CountBunches is a number of bunches.
	// It dependents on now server/node performance and count of session.
	CountBunches = 100 // TODO: move to the configuration parameters or make calculable by server configuration
)
View Source
const (
	MaxAllowedExtendedTTL = int64(300)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bunch

type Bunch struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

type Storage

type Storage struct {
	sync.RWMutex

	Bunches      map[uint32]*Bunch
	CountBunches uint32
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context) *Storage

New is a simple constructor.

func (*Storage) Create

func (s *Storage) Create(ttl uint32) string

func (*Storage) Destroy

func (s *Storage) Destroy(id string) bool

func (*Storage) Extend

func (s *Storage) Extend(id string, ttl uint32) bool

func (*Storage) ListAllSessions

func (s *Storage) ListAllSessions() []byte

ListAllSessions returns list of all active sessions and remaining TTL from all bunches.

Jump to

Keyboard shortcuts

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