spoe

package
v6.0.0-...-fc8ae8f Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Params

type Params struct {
	UseValidation          *bool
	PersistentTransactions *bool
	SkipFailedTransactions *bool
	SpoeDir                string
	TransactionDir         string
	ConfigurationFile      string
	BackupsNumber          int
}

type SingleSpoe

type SingleSpoe struct {
	Parser      *spoe.Parser
	Transaction *conf.Transaction
	// contains filtered or unexported fields
}

SingleSpoe configuration client Parser is the SPOE parser instance that loads SPOE configuration file on Init and when transaction is committed it gets replaced with the SPOE parser from parsers map parsers map contains a SPOE parser for each transaction, which loads data from transaction files on StartTransaction, and deletes on CommitTransaction We save data to file on every change for persistence

func (*SingleSpoe) AddParser

func (c *SingleSpoe) AddParser(transactionID string) error

AddParser adds parser to parser map

func (*SingleSpoe) CheckTransactionOrVersion

func (c *SingleSpoe) CheckTransactionOrVersion(transactionID string, version int64) (string, error)

func (*SingleSpoe) CommitParser

func (c *SingleSpoe) CommitParser(transactionID string) error

CommitParser commits transaction parser, deletes it from parsers map, and replaces master Parser

func (*SingleSpoe) CreateAgent

func (c *SingleSpoe) CreateAgent(scope string, data *models.SpoeAgent, transactionID string, version int64) error

CreateAgent creates a agent in configuration. One of version or transactionID is mandatory. Returns error on fail, nil on success.

func (*SingleSpoe) CreateGroup

func (c *SingleSpoe) CreateGroup(scope string, data *models.SpoeGroup, transactionID string, version int64) error

CreateGroup creates a group in configuration. One of version or transactionID is mandatory. Returns error on fail, nil on success.

func (*SingleSpoe) CreateMessage

func (c *SingleSpoe) CreateMessage(scope string, data *models.SpoeMessage, transactionID string, version int64) error

CreateMessage creates a message in configuration. One of version or transactionID is mandatory. Returns error on fail, nil on success.

func (*SingleSpoe) CreateScope

func (c *SingleSpoe) CreateScope(data *models.SpoeScope, transactionID string, version int64) error

CreateScope creates a scope in configuration One of version or transactionID is mandatory Returns error on fail, nil on success.

func (*SingleSpoe) DeleteAgent

func (c *SingleSpoe) DeleteAgent(scope, name, transactionID string, version int64) error

DeleteAgent deletes an agent in configuration. One of version or transactionID is mandatory. Returns error on fail, nil on success.

func (*SingleSpoe) DeleteGroup

func (c *SingleSpoe) DeleteGroup(scope, name, transactionID string, version int64) error

DeleteGroup deletes an group in configuration. One of version or transactionID is mandatory. Returns error on fail, nil on success.

func (*SingleSpoe) DeleteMessage

func (c *SingleSpoe) DeleteMessage(scope, name, transactionID string, version int64) error

DeleteMessage deletes an message in configuration. One of version or transactionID is mandatory. Returns error on fail, nil on success.

func (*SingleSpoe) DeleteParser

func (c *SingleSpoe) DeleteParser(transactionID string) error

DeleteParser deletes parser from parsers map

func (*SingleSpoe) DeleteScope

func (c *SingleSpoe) DeleteScope(name, transactionID string, version int64) error

DeleteScope deletes a scope in configuration One of version or transactionID is mandatory Returns error on fail, nil on success.

func (*SingleSpoe) EditAgent

func (c *SingleSpoe) EditAgent(scope string, data *models.SpoeAgent, transactionID string, version int64) error

EditAgent edits a agent in configuration. One of version or transactionID is mandatory. Returns error on fail, nil on success.

func (*SingleSpoe) EditGroup

func (c *SingleSpoe) EditGroup(scope string, data *models.SpoeGroup, name, transactionID string, version int64) error

EditMessage edits a group in configuration. One of version or transactionID is mandatory. Returns error on fail, nil on success.

func (*SingleSpoe) EditMessage

func (c *SingleSpoe) EditMessage(scope string, data *models.SpoeMessage, name, transactionID string, version int64) error

EditMessage edits a message in configuration. One of version or transactionID is mandatory. Returns error on fail, nil on success.

func (*SingleSpoe) GetAgent

func (c *SingleSpoe) GetAgent(scope, name, transactionID string) (int64, *models.SpoeAgent, error)

GetAgent returns configuration version and a requested agent. Returns error on fail or if agent does not exist.

func (*SingleSpoe) GetAgents

func (c *SingleSpoe) GetAgents(scope, transactionID string) (int64, models.SpoeAgents, error)

GetAgents returns configuration version and an array of configured agents. Returns error on fail.

func (*SingleSpoe) GetConfigurationVersion

func (c *SingleSpoe) GetConfigurationVersion(transactionID string) (int64, error)

GetConfigurationVersion returns configuration version

func (*SingleSpoe) GetFailedParserTransactionVersion

func (c *SingleSpoe) GetFailedParserTransactionVersion(transactionID string) (int64, error)

func (*SingleSpoe) GetGroup

func (c *SingleSpoe) GetGroup(scope, name, transactionID string) (int64, *models.SpoeGroup, error)

GetGroup returns configuration version and a requested group Returns an error on fail or if group does not exist.

func (*SingleSpoe) GetGroups

func (c *SingleSpoe) GetGroups(scope, transactionID string) (int64, models.SpoeGroups, error)

GetGroups returns configuration version and an array of configured messages. Returns error on fail.

func (*SingleSpoe) GetMessage

func (c *SingleSpoe) GetMessage(scope, name, transactionID string) (int64, *models.SpoeMessage, error)

GetMessage returns configuration version and a requested message. Returns error on fail or if message does not exist.

func (*SingleSpoe) GetMessages

func (c *SingleSpoe) GetMessages(scope, transactionID string) (int64, models.SpoeMessages, error)

GetMessages returns configuration version and an array of configured messages. Returns error on fail.

func (*SingleSpoe) GetParser

func (c *SingleSpoe) GetParser(transactionID string) (*spoe.Parser, error)

GetParser returns a parser for given transactionID, if transactionID is "", it returns "master" parser

func (*SingleSpoe) GetParserTransactions

func (c *SingleSpoe) GetParserTransactions() models.Transactions

GetParserTransactions returns parser transactions

func (*SingleSpoe) GetScope

func (c *SingleSpoe) GetScope(name, transactionID string) (int64, *models.SpoeScope, error)

GetScope returns configuration version and a requested scope Returns error on fail or if scope does not exist.

func (*SingleSpoe) GetScopes

func (c *SingleSpoe) GetScopes(transactionID string) (int64, models.SpoeScopes, error)

GetScopes returns configuration version and an array of configured scopes Returns error on fail.

func (*SingleSpoe) GetVersion

func (c *SingleSpoe) GetVersion(transactionID string) (int64, error)

GetVersion returns configuration file version

func (*SingleSpoe) HasParser

func (c *SingleSpoe) HasParser(transactionID string) bool

HasParser checks whether transaction exists in parser

func (*SingleSpoe) IncrementTransactionVersion

func (c *SingleSpoe) IncrementTransactionVersion(transactionID string) error

func (*SingleSpoe) IncrementVersion

func (c *SingleSpoe) IncrementVersion() error

func (*SingleSpoe) InitTransactionParsers

func (c *SingleSpoe) InitTransactionParsers() error

InitTransactionParsers checks transactions and initializes parsers map with transactions in_progress

func (*SingleSpoe) LoadData

func (c *SingleSpoe) LoadData(filename string) error

func (*SingleSpoe) Save

func (c *SingleSpoe) Save(transactionFile, transactionID string) error

func (*SingleSpoe) SetValidateConfigFiles

func (c *SingleSpoe) SetValidateConfigFiles(before, after []string)

SetValidateConfigFiles set before and after validation files

type Spoe

type Spoe interface {
	GetSingleSpoe(name string) (*SingleSpoe, error)
	GetAll() ([]string, error)
	Delete(name string) error
	Create(name string, readCloser io.ReadCloser) (string, error)
	Get(name string) (string, error)
}

func NewSpoe

func NewSpoe(params Params) (Spoe, error)

Jump to

Keyboard shortcuts

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