Documentation ¶
Index ¶
- Constants
- Variables
- func IsValidFQDN(s string) bool
- func LogWithPath(l *plog.Logger, p Path) *plog.Logger
- func Random() string
- type FQDN
- type Kind
- type Kinds
- type M
- type Metadata
- type Path
- func (t Path) ConfigFile() string
- func (t Path) Equal(o Path) bool
- func (t Path) Exists() bool
- func (t Path) FQN() string
- func (t Path) FrozenFile() string
- func (t Path) IsZero() bool
- func (t Path) LogDir() string
- func (t Path) LogFile() string
- func (t Path) MarshalText() ([]byte, error)
- func (t Path) Match(pattern string) bool
- func (t Path) Path() Path
- func (t Path) ScalerSliceIndex() int
- func (t Path) String() string
- func (t Path) TmpDir() string
- func (t Path) ToMetadata() *Metadata
- func (t *Path) UnmarshalText(b []byte) error
- func (t Path) VarDir() string
- type Paths
- type Relation
- type Relations
Constants ¶
const (
// Separator is the character separating a path's namespace, kind and name
Separator = "/"
)
Variables ¶
var ( KindKVStore = []Kind{ KindCfg, KindSec, KindUsr, } KindAll = []Kind{ KindSvc, KindVol, KindCfg, KindSec, KindUsr, KindCcfg, KindNscfg, } KindStrings = []string{ string(KindSvc), string(KindVol), string(KindCfg), string(KindSec), string(KindUsr), string(KindCcfg), string(KindNscfg), } )
var ( Cluster = Path{Name: "cluster", Namespace: "root", Kind: KindCcfg} // ErrInvalid is raised when the path allocator can not return a path // because one of the path element is not valid. ErrInvalid = errors.New("invalid path") )
Functions ¶
func IsValidFQDN ¶
IsValidFQDN verifies the string meets the RFC1123 requirements
func LogWithPath ¶
LogWithPath returns plog.Logger from existing logger with naming attrs sets
Types ¶
type FQDN ¶
func (FQDN) MarshalText ¶
MarshalText implements the json interface
func (*FQDN) UnmarshalText ¶
UnmarshalText implements the json interface
type Kind ¶
type Kind string
Kind is opensvc object kind.
const ( KindInvalid Kind = "" // KindSvc is the kind of objects containing app, containers, or volumes resources. KindSvc Kind = "svc" // KindVol is the kind of objects containing fs, disk resources. Allocated from Pools. KindVol Kind = "vol" // KindCfg is the kind of objects containing unencrypted key/val pairs used to abstract Svc configurations KindCfg Kind = "cfg" // KindSec is the kind of objects containing encrypted key/val pairs used to abstract Svc configurations KindSec Kind = "sec" // KindUsr is the kind of objects containing a API user grants and credentials KindUsr Kind = "usr" // KindCcfg is the kind of objects containing the cluster configuration KindCcfg Kind = "ccfg" // KindNscfg is the kind of objects containing a namespace configuration KindNscfg Kind = "nscfg" )
type Metadata ¶
type Metadata struct { Name string `json:"name"` Namespace string `json:"namespace"` Kind Kind `json:"kind"` }
Metadata is the parsed representation of a path, used by api handlers to ease dumb clients access to individual path fields.
type Path ¶
type Path struct { // Name is the name part of the path Name string // Namespace is the namespace part of the path Namespace string // Kind is the kind part of the path Kind Kind }
Path represents an opensvc object path-like identifier. Ex: ns1/svc/svc1
func NewPathFromStrings ¶
func (Path) ConfigFile ¶
ConfigFile returns the object configuration file path on the local filesystem.
func (Path) FrozenFile ¶
FrozenFile returns the path of the flag file blocking orchestrations and resource restart.
func (Path) LogDir ¶
LogDir returns the directory on the local filesystem where the object stores its temporary files.
func (Path) MarshalText ¶
MarshalText implements the json interface
func (Path) Match ¶
Match returns true if the object matches the pattern, using a fnmatch matching algorithm with a few special cases to mask the root namespace tricks and the svc object kind as default.
Trick: The 'f*' pattern matches all svc objects in the root namespace. The '*' pattern matches all svc objects in all namespaces.
func (Path) ScalerSliceIndex ¶
ScalerSliceIndex returns the <i> int from a scaler slice name like <i>.<scalerName> Return -1 if not a scaler slice.
func (Path) TmpDir ¶
TmpDir returns the directory on the local filesystem where the object stores its temporary files.
func (Path) ToMetadata ¶
ToMetadata returns the parsed representation of the path
func (*Path) UnmarshalText ¶
UnmarshalText implements the json interface
type Paths ¶
type Paths []Path
Paths is a list of object paths.
func InstalledPaths ¶
InstalledPaths returns a list of every object path with a locally installed configuration file.
func ParsePaths ¶
ParsePaths returns a new naming.Paths from a []string path list.
func (Paths) Namespaces ¶
Namespaces return the list of unique namespaces in Paths
func (Paths) StrMap ¶
StrMap converts Paths into a map indexed by path string representation. This format is useful for fast Has(string) bool functions.