API: internal/sessionstore

Back to API Index

Legend: Type, Function, Method

Package: package sessionstore // import "github.com/smysnk/sikuligo/internal/sessionstore"

Symbol Index

Types

Functions

Methods

Declarations

Types

Type APISession

Type APISessionStartInput

Type ClientSession

Type ClientSessionStartInput

Type Interaction

Type InteractionInput

Type MethodMetrics

Type Store

Functions

Function OpenSQLite

Methods

Method Store.Close

Method Store.CountAPISessions

Method Store.CountClientSessions

Method Store.CountInteractions

Method Store.EndAPISession

Method Store.EndClientSession

Method Store.LatestAPISession

Method Store.ListClientSessionsByAPI

Method Store.ListInteractionsByClient

Method Store.ListRecentAPISessions

Method Store.MethodMetricsByAPISession

Method Store.RecordInteraction

Method Store.StartAPISession

Method Store.StartClientSession

Raw Package Doc

package sessionstore // import "github.com/smysnk/sikuligo/internal/sessionstore"


TYPES

type APISession struct {
	ID              uint `gorm:"primaryKey"`
	SessionKey      string
	PID             int
	GRPCListenAddr  string
	AdminListenAddr string
	StartedAt       time.Time
	EndedAt         *time.Time
}

type APISessionStartInput struct {
	PID             int
	GRPCListenAddr  string
	AdminListenAddr string
}

type ClientSession struct {
	ID           uint `gorm:"primaryKey"`
	APISessionID uint
	SessionKey   string
	ConnectionID string
	RemoteAddr   string
	LocalAddr    string
	StartedAt    time.Time
	EndedAt      *time.Time
	LastSeenAt   time.Time
}

type ClientSessionStartInput struct {
	APISessionID uint
	ConnectionID string
	RemoteAddr   string
	LocalAddr    string
}

type Interaction struct {
	ID              uint `gorm:"primaryKey"`
	APISessionID    uint
	ClientSessionID uint
	Method          string
	TraceID         string
	GRPCCode        string
	DurationMS      int64
	StartedAt       time.Time
	CompletedAt     time.Time
}

type InteractionInput struct {
	APISessionID    uint
	ClientSessionID uint
	Method          string
	TraceID         string
	GRPCCode        string
	DurationMS      int64
	StartedAt       time.Time
	CompletedAt     time.Time
}

type MethodMetrics struct {
	Method       string
	Requests     uint64
	Errors       uint64
	AuthFailures uint64
	AvgDuration  float64
	MaxDuration  int64
	LastCode     string
	LastTraceID  string
	LastSeen     time.Time
}

type Store struct {
	// Has unexported fields.
}

func OpenSQLite(path string) (*Store, error)

func (s *Store) Close() error

func (s *Store) CountAPISessions(ctx context.Context) (int64, error)

func (s *Store) CountClientSessions(ctx context.Context) (int64, error)

func (s *Store) CountInteractions(ctx context.Context) (int64, error)

func (s *Store) EndAPISession(ctx context.Context, apiSessionID uint, endedAt time.Time) error

func (s *Store) EndClientSession(ctx context.Context, clientSessionID uint, endedAt time.Time) error

func (s *Store) LatestAPISession(ctx context.Context) (APISession, bool, error)

func (s *Store) ListClientSessionsByAPI(ctx context.Context, apiSessionID uint) ([]ClientSession, error)

func (s *Store) ListInteractionsByClient(ctx context.Context, clientSessionID uint, limit int) ([]Interaction, error)

func (s *Store) ListRecentAPISessions(ctx context.Context, limit int) ([]APISession, error)

func (s *Store) MethodMetricsByAPISession(ctx context.Context, apiSessionID uint) ([]MethodMetrics, error)

func (s *Store) RecordInteraction(ctx context.Context, in InteractionInput) error

func (s *Store) StartAPISession(ctx context.Context, in APISessionStartInput) (APISession, error)

func (s *Store) StartClientSession(ctx context.Context, in ClientSessionStartInput) (ClientSession, error)