session

package
v0.0.0-...-308df95 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: BSD-2-Clause, BSD-3-Clause, LGPL-2.1, + 2 more Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Shared   = true
	Unshared = false
)

Variables

This section is empty.

Functions

func MakeCommitError

func MakeCommitError(err error) *commitresp

Types

type Auther

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

Implements the Auther interface from union tree

func (*Auther) AuthCreate

func (s *Auther) AuthCreate(path []string) bool

func (*Auther) AuthDelete

func (s *Auther) AuthDelete(path []string) bool

func (*Auther) AuthRead

func (s *Auther) AuthRead(path []string) bool

func (*Auther) AuthReadSecrets

func (s *Auther) AuthReadSecrets(path []string) bool

func (*Auther) AuthUpdate

func (s *Auther) AuthUpdate(path []string) bool

type CommitMgr

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

func NewCommitMgr

func NewCommitMgr(running *data.AtomicNode, schema schema.ModelSet) *CommitMgr

func (*CommitMgr) Commit

func (m *CommitMgr) Commit(sid string, ctx *configd.Context, candidate *data.Node, message string, debug bool) *commitresp

func (*CommitMgr) Running

func (m *CommitMgr) Running() *data.Node

func (*CommitMgr) SetEffective

func (m *CommitMgr) SetEffective(effective *Session)

type Session

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

func NewSession

func NewSession(
	sid string,
	cmgr *CommitMgr,
	st,
	stFull schema.ModelSet,
	options ...SessionOption,
) *Session

func (*Session) Changed

func (s *Session) Changed(ctx *configd.Context) bool

func (*Session) Comment

func (s *Session) Comment(ctx *configd.Context, path []string) error

func (*Session) Commit

func (s *Session) Commit(ctx *configd.Context, message string, debug bool) ([]*exec.Output, []error, bool)

func (*Session) CopyConfig

func (s *Session) CopyConfig(
	ctx *configd.Context,
	sourceDatastore,
	sourceEncoding,
	sourceConfig,
	sourceURL,
	targetDatastore,
	targetURL string,
) error

func (*Session) Delete

func (s *Session) Delete(ctx *configd.Context, path []string) error

func (*Session) Discard

func (s *Session) Discard(ctx *configd.Context) error

func (*Session) EditConfigXML

func (s *Session) EditConfigXML(ctx *configd.Context, config_target, default_operation, test_option, error_option, config string) error

func (*Session) Exists

func (s *Session) Exists(ctx *configd.Context, path []string) bool

func (*Session) Get

func (s *Session) Get(ctx *configd.Context, path []string) ([]string, error)

func (*Session) GetFullTree

func (s *Session) GetFullTree(ctx *configd.Context, path []string, opts *TreeOpts) (union.Node, error, []error)

GetFullTree - return state and config nodes, plus any error and warnings. error is fatal; warnings relate to specific parts of the tree not returning valid data.

func (*Session) GetHelp

func (s *Session) GetHelp(ctx *configd.Context, schema bool, path []string) (map[string]string, error)

func (*Session) GetStatus

func (s *Session) GetStatus(ctx *configd.Context, path []string) (rpc.NodeStatus, error)

func (*Session) GetTree

func (s *Session) GetTree(ctx *configd.Context, path []string, opts *TreeOpts) (union.Node, error)

func (*Session) GetType

func (s *Session) GetType(ctx *configd.Context, path []string) (rpc.NodeType, error)

func (*Session) IsDefault

func (s *Session) IsDefault(ctx *configd.Context, path []string) (bool, error)

func (*Session) IsShared

func (s *Session) IsShared() bool

func (*Session) Kill

func (s *Session) Kill()

func (*Session) Load

func (s *Session) Load(ctx *configd.Context, file string, r io.Reader) (error, []error)

func (*Session) Lock

func (s *Session) Lock(ctx *configd.Context) (int32, error)

func (*Session) Locked

func (s *Session) Locked(ctx *configd.Context) (int32, error)

func (*Session) MarkSaved

func (s *Session) MarkSaved(ctx *configd.Context, saved bool)

func (*Session) Merge

func (s *Session) Merge(ctx *configd.Context, file string) (error, []error)

func (*Session) MergeTree

func (s *Session) MergeTree(ctx *configd.Context) *data.Node

func (*Session) MergeTreeWithoutDefaults

func (s *Session) MergeTreeWithoutDefaults(ctx *configd.Context) *data.Node

func (*Session) NewAuther

func (s *Session) NewAuther(ctx *configd.Context) union.Auther

func (*Session) OwnedBy

func (s *Session) OwnedBy(uid uint32) bool

func (*Session) Saved

func (s *Session) Saved(ctx *configd.Context) bool

func (*Session) Set

func (s *Session) Set(ctx *configd.Context, path []string) error

func (*Session) Show

func (s *Session) Show(ctx *configd.Context, path []string, hideSecrets, showDefaults bool) (string, error)

func (*Session) ShowForceSecrets

func (s *Session) ShowForceSecrets(ctx *configd.Context, path []string, hideSecrets, showDefaults bool) (string, error)

func (*Session) Unlock

func (s *Session) Unlock(ctx *configd.Context) (int32, error)

func (*Session) Validate

func (s *Session) Validate(ctx *configd.Context) ([]*exec.Output, []error, bool)

func (*Session) ValidateSet

func (s *Session) ValidateSet(ctx *configd.Context, path []string) error

type SessionMgr

type SessionMgr struct {
	Elog *log.Logger
	// contains filtered or unexported fields
}

Session manager is a monitor that provides access to the shared session state. All methods must be protected by Mutex

func NewSessionMgr

func NewSessionMgr() *SessionMgr

func NewSessionMgrCustomLog

func NewSessionMgrCustomLog(elog *log.Logger) *SessionMgr

func (*SessionMgr) Create

func (mgr *SessionMgr) Create(
	ctx *configd.Context, sid string, cmgr *CommitMgr, st, stFull schema.ModelSet, shared bool,
) (*Session, error)

func (*SessionMgr) Destroy

func (mgr *SessionMgr) Destroy(ctx *configd.Context, sid string) error

func (*SessionMgr) Get

func (mgr *SessionMgr) Get(ctx *configd.Context, sid string) (*Session, error)

func (*SessionMgr) Lock

func (mgr *SessionMgr) Lock(ctx *configd.Context, sid string) (int32, error)

func (*SessionMgr) Unlock

func (mgr *SessionMgr) Unlock(ctx *configd.Context, sid string) (int32, error)

func (*SessionMgr) UnlockAllPid

func (mgr *SessionMgr) UnlockAllPid(ctx *configd.Context) error

type SessionOption

type SessionOption func(*session)

func WithOwner

func WithOwner(owner uint32) SessionOption

type TreeOpts

type TreeOpts struct {
	Defaults, Secrets, CouldExistIsAllowed bool
}

Defaults - return defaults Secrets - return secrets in plain text CouldExist - path is valid if it *could* exist, but currently doesn't

func NewTreeOpts

func NewTreeOpts(flags map[string]interface{}) *TreeOpts

func (*TreeOpts) AllowCouldExist

func (t *TreeOpts) AllowCouldExist()

func (*TreeOpts) ToUnionOptions

func (t *TreeOpts) ToUnionOptions() []union.UnionOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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