Documentation ¶
Index ¶
- Constants
- Variables
- type Collection
- type CollectionEntry
- type CollectionTree
- type CollectionTreeEntry
- type Graph
- type GroupPatterns
- type Item
- type MetricGroup
- type Provider
- type ProviderFilter
- type ProviderFilters
- type Series
- type SeriesGroup
- type SeriesGroups
- type SourceGroup
- type Storage
- func (s *Storage) Close() error
- func (s *Storage) NewCollection() *Collection
- func (s *Storage) NewCollectionTree(root string) (*CollectionTree, error)
- func (s *Storage) NewGraph() *Graph
- func (s *Storage) NewMetricGroup() *MetricGroup
- func (s *Storage) NewProvider() *Provider
- func (s *Storage) NewSourceGroup() *SourceGroup
- func (s *Storage) SQL() *sqlstorage.Storage
Constants ¶
const (
// GroupPrefix represents the source or metric group prefix.
GroupPrefix = "group:"
)
Variables ¶
var ( // ErrEmptyGroup represents an empty group error. ErrEmptyGroup = errors.New("empty group") // ErrInvalidAlias represents an invalid alias error. ErrInvalidAlias = errors.New("invalid alias") // ErrInvalidID represents an invalid identifier error. ErrInvalidID = errors.New("invalid identifier") // ErrInvalidInterval represents an invalid interval error. ErrInvalidInterval = errors.New("invalid interval") // ErrInvalidName represents an invalid name error. ErrInvalidName = errors.New("invalid name") // ErrInvalidPattern represents an invalid pattern error. ErrInvalidPattern = errors.New("invalid pattern") // ErrInvalidPriority represents an invalid priority error. ErrInvalidPriority = errors.New("invalid priority") // ErrUnresolvableItem represents an unresolvable item error. ErrUnresolvableItem = errors.New("unresolvable item") // ErrUnscannableValue represents an unscannable value error. ErrUnscannableValue = errors.New("unscannable value") )
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection struct { Item Entries []*CollectionEntry `json:"entries,omitempty"` Link *Collection `json:"-"` LinkID *string `` /* 134-byte string literal not displayed */ Attributes maputil.Map `gorm:"type:text" json:"attributes,omitempty"` Alias *string `gorm:"type:varchar(128);unique_index" json:"alias,omitempty"` Options maputil.Map `gorm:"type:text" json:"options,omitempty"` Parent *Collection `json:"-"` ParentID *string `` /* 140-byte string literal not displayed */ Template bool `gorm:"not null" json:"template"` // contains filtered or unexported fields }
Collection represents a storage collection item instance.
func (*Collection) BeforeSave ¶
func (c *Collection) BeforeSave(scope *gorm.Scope) error
BeforeSave handles the ORM 'BeforeSave' callback.
func (*Collection) Clone ¶
func (c *Collection) Clone() *Collection
Clone returns a clone of the collection item instance.
func (*Collection) Expand ¶
func (c *Collection) Expand(attrs maputil.Map) error
Expand expands the collection item instance using its linked instance.
func (*Collection) HasParent ¶
func (c *Collection) HasParent() bool
HasParent returns whether or not the collection item has a parent instance.
func (*Collection) Resolve ¶
func (c *Collection) Resolve(cache map[string]*Collection) error
Resolve resolves both the collection item linked and parent instances.
type CollectionEntry ¶
type CollectionEntry struct { Index int `gorm:"type:int NOT NULL;primary_key" json:"-"` Collection *Collection `json:"-"` CollectionID string `` /* 135-byte string literal not displayed */ Graph *Graph `json:"-"` GraphID string `` /* 129-byte string literal not displayed */ Attributes maputil.Map `gorm:"type:text" json:"attributes,omitempty"` Options maputil.Map `gorm:"type:text" json:"options,omitempty"` }
CollectionEntry represents a storage collection entry instance.
type CollectionTree ¶
type CollectionTree []*CollectionTreeEntry
CollectionTree represents a storage collection tree instance.
func (CollectionTree) Len ¶
func (c CollectionTree) Len() int
func (CollectionTree) Less ¶
func (c CollectionTree) Less(i, j int) bool
func (CollectionTree) Swap ¶
func (c CollectionTree) Swap(i, j int)
type CollectionTreeEntry ¶
type CollectionTreeEntry struct { ID string `json:"id,omitempty"` Label string `json:"label,omitempty"` Alias string `json:"alias,omitempty"` Parent string `json:"parent,omitempty"` Children *CollectionTree `json:"children,omitempty"` }
CollectionTreeEntry represents a storage collections tree entry instance.
type Graph ¶
type Graph struct { Item Groups SeriesGroups `gorm:"type:text;not null" json:"groups,omitempty"` Link *Graph `json:"-"` LinkID *string `` /* 129-byte string literal not displayed */ Attributes maputil.Map `gorm:"type:text" json:"attributes,omitempty"` Alias *string `gorm:"type:varchar(128);unique_index" json:"alias,omitempty"` Options maputil.Map `gorm:"type:text" json:"options,omitempty"` Template bool `gorm:"not null" json:"template"` // contains filtered or unexported fields }
Graph represents a library graph item instance.
func (*Graph) BeforeSave ¶
BeforeSave handles the ORM 'BeforeSave' callback.
type GroupPatterns ¶
type GroupPatterns []string
GroupPatterns represents a list of group patterns.
func (*GroupPatterns) Scan ¶
func (gp *GroupPatterns) Scan(v interface{}) error
Scan unmarshals the group patterns retrieved from SQL drivers.
type Item ¶
type Item struct { Type string `gorm:"-" json:"type,omitempty"` ID string `gorm:"type:varchar(36);not null;primary_key" json:"id"` Name string `gorm:"type:varchar(128);not null;unique_index" json:"name"` Description *string `gorm:"type:text" json:"description"` Created time.Time `gorm:"not null;default:current_timestamp" json:"created"` Modified time.Time `gorm:"not null;default:current_timestamp" json:"modified"` // contains filtered or unexported fields }
Item represents a storage item instance.
func (*Item) BeforeSave ¶
BeforeSave handles the ORM 'BeforeSave' callback.
func (*Item) SetStorage ¶
SetStorage sets the item internal storage reference.
type MetricGroup ¶
type MetricGroup struct { Item Patterns GroupPatterns `gorm:"type:text;not null" json:"patterns"` }
MetricGroup represents a library metric group item instance.
func (*MetricGroup) BeforeSave ¶
func (mg *MetricGroup) BeforeSave(scope *gorm.Scope) error
BeforeSave handles the ORM 'BeforeSave' callback.
func (MetricGroup) TableName ¶
func (MetricGroup) TableName() string
TableName returns the table name to use in the database.
type Provider ¶
type Provider struct { Item Connector string `gorm:"type:varchar(32);not null" json:"connector"` Settings *maputil.Map `gorm:"type:text" json:"settings"` Filters ProviderFilters `gorm:"type:text" json:"filters"` RefreshInterval int `gorm:"not null;default:0" json:"refresh_interval"` Priority int `gorm:"not null;default:0" json:"priority"` Enabled bool `gorm:"not null;default:true" json:"enabled"` }
Provider represents a storage provider item instance.
type ProviderFilter ¶
type ProviderFilter struct { Action string `json:"action"` Target string `json:"target"` Pattern string `json:"pattern"` Into string `json:"into"` }
ProviderFilter represents a storage provider filter entry instance.
type ProviderFilters ¶
type ProviderFilters []*ProviderFilter
ProviderFilters represents a list of storage provider filters.
func (*ProviderFilters) Scan ¶
func (pf *ProviderFilters) Scan(v interface{}) error
Scan unmarshals the provider filter entries retrieved from SQL drivers.
type Series ¶
type Series struct { Name string `json:"name"` Origin string `json:"origin"` Source string `json:"source"` Metric string `json:"metric"` Options maputil.Map `json:"options,omitempty"` }
Series represents a library graph series entry instance.
type SeriesGroup ¶
type SeriesGroup struct { Name string `json:"name"` Operator int `json:"operator"` Consolidate int `json:"consolidate"` Series []*Series `json:"series"` Options maputil.Map `json:"options,omitempty"` }
SeriesGroup represents a library graph series group entry instance.
type SeriesGroups ¶
type SeriesGroups []*SeriesGroup
SeriesGroups represents a list of library graph series groups.
func (*SeriesGroups) Scan ¶
func (sg *SeriesGroups) Scan(v interface{}) error
Scan unmarshals the series groups retrieved from SQL drivers.
type SourceGroup ¶
type SourceGroup struct { Item Patterns GroupPatterns `gorm:"type:text;not null" json:"patterns"` }
SourceGroup represents a library source group item instance.
func (*SourceGroup) BeforeSave ¶
func (sg *SourceGroup) BeforeSave(scope *gorm.Scope) error
BeforeSave handles the ORM 'BeforeSave' callback.
func (SourceGroup) TableName ¶
func (SourceGroup) TableName() string
TableName returns the table name to use in the database.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage represents a storage instance.
func (*Storage) NewCollection ¶
func (s *Storage) NewCollection() *Collection
NewCollection creates a new collection item instance.
func (*Storage) NewCollectionTree ¶
func (s *Storage) NewCollectionTree(root string) (*CollectionTree, error)
NewCollectionTree creates a new storage collection tree instance.
func (*Storage) NewMetricGroup ¶
func (s *Storage) NewMetricGroup() *MetricGroup
NewMetricGroup creates a new storage metric group item instance.
func (*Storage) NewProvider ¶
NewProvider creates a new storage provider item instance.
func (*Storage) NewSourceGroup ¶
func (s *Storage) NewSourceGroup() *SourceGroup
NewSourceGroup creates a new storage source group item instance.
func (*Storage) SQL ¶
func (s *Storage) SQL() *sqlstorage.Storage
SQL returns the storage underlying SQL storage instance.