session

package
v3.10.2 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxEnvSizeInBytes     = 128*1024 - 128
	MaxEnvironSizeInBytes = MaxEnvSizeInBytes * 8
)
View Source
const SessionListCapacity = 1024

SessionListCapacity is a maximum number of sessions stored in a single SessionList.

Variables

View Source
var ErrEnvTooLarge = errors.New("env too large")

Functions

func DiffEnvStores

func DiffEnvStores(initial, updated *EnvStoreMap) (newOrUpdated, unchanged, deleted []string)

func SplitEnv

func SplitEnv(str string) (string, string)

Types

type EnvStore

type EnvStore interface {
	Load(source string, envs ...string) error
	Merge(ctx context.Context, envs ...string) error
	Get(k string) (string, bool)
	Set(ctx context.Context, k, v string) error
	Delete(ctx context.Context, k string) error
	Items() ([]string, error)
}

type EnvStoreMap

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

func NewEnvStore

func NewEnvStore() *EnvStoreMap

func (*EnvStoreMap) Delete

func (s *EnvStoreMap) Delete(ctx context.Context, k string) error

func (*EnvStoreMap) Get

func (s *EnvStoreMap) Get(k string) (string, bool)

func (*EnvStoreMap) Items

func (s *EnvStoreMap) Items() ([]string, error)

func (*EnvStoreMap) Load

func (s *EnvStoreMap) Load(source string, envs ...string) error

func (*EnvStoreMap) Merge

func (s *EnvStoreMap) Merge(ctx context.Context, envs ...string) error

func (*EnvStoreMap) Set

func (s *EnvStoreMap) Set(ctx context.Context, k, v string) error

type Session

type Session struct {
	ID string
	// contains filtered or unexported fields
}

Session is an object which lifespan contains multiple executions. It's used to exchange information between executions. Currently, it only keeps track of environment variables.

func New

func New(opts ...SessionOption) (*Session, error)

func New(owl bool, proj *project.Project, seedEnv []string) (*Session, error) {

func (*Session) DeleteEnv

func (s *Session) DeleteEnv(ctx context.Context, keys ...string) error

func (*Session) GetAllEnv

func (s *Session) GetAllEnv() []string

func (*Session) GetEnv

func (s *Session) GetEnv(key string) (string, bool)

func (*Session) SetEnv

func (s *Session) SetEnv(ctx context.Context, env ...string) error

type SessionList

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

func NewSessionList

func NewSessionList() (*SessionList, error)

func (*SessionList) Add

func (sl *SessionList) Add(session *Session)

func (*SessionList) Delete

func (sl *SessionList) Delete(id string) bool

func (*SessionList) Get

func (sl *SessionList) Get(id string) (*Session, bool)

func (*SessionList) List

func (sl *SessionList) List() []*Session

func (*SessionList) Newest

func (sl *SessionList) Newest() (*Session, bool)

type SessionOption

type SessionOption func(*sessionFactory) *sessionFactory

func WithOwl

func WithOwl(owl bool) SessionOption

func WithProject

func WithProject(proj *project.Project) SessionOption

func WithSeedEnv

func WithSeedEnv(seedEnv []string) SessionOption

Jump to

Keyboard shortcuts

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