sessionstorage

package
v0.18.0-beta07 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

Session storage service configuration options.

func ProvideConfig

func ProvideConfig() Config

ProvideConfig is a wire provider for session storage configuration.

type Service

type Service interface {
	// InsertSession stores given session in memory. If number of visitor session
	// exceed configured max session per visitor, this function returns false and
	// session isn't stored.
	InsertSession(deviceId uint64, session event.Session) bool
	// AddPageview adds a pageview to a session with the given device id
	// latest path (referrer). Session is returned along a true flag if it was
	// found.
	AddPageview(deviceId uint64, referrer event.ReferrerUri, uri uri.Uri) (event.Session, bool)
	// IdentifySession updates stored session visitor id. Updated session and
	// boolean found flag are returned.
	IdentifySession(deviceId uint64, pageUri uri.Uri, visitorId string) (event.Session, bool)
	// WaitForSession retrieves stored session and returns it. If session is not
	// found, it waits until it is created or timeout.
	// Returned boolean flag is false if wait timed out and returned an empty
	// session.
	WaitSession(deviceId uint64, pageUri uri.Uri, timeout time.Duration) (event.Session, bool)
}

Service define an in memory session storage.

func ProvideService

func ProvideService(
	logger zerolog.Logger,
	cfg Config,
	promRegistry *prometheus.Registry,
) Service

ProvideService is a wire provider for in memory session storage.

Jump to

Keyboard shortcuts

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