plain

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package plain provides the implementation of store.Store interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStore

func NewStore(dataPath string) store.Store

NewStore returns a new Store. the argument `dataPath` is the file path where write the data. If `dataPath` is empty, the data aren't written to the file.

Types

type Store

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

Store is the implementation of the Store interface with pure golang.

func (*Store) AddIndexSet

func (store *Store) AddIndexSet(is *graylog.IndexSet) error

AddIndexSet adds an index set to the store.

func (*Store) AddInput

func (store *Store) AddInput(input *graylog.Input) error

AddInput adds an input to the store.

func (*Store) AddRole

func (store *Store) AddRole(role *graylog.Role) error

AddRole adds a new role to the store.

func (*Store) AddStream

func (store *Store) AddStream(stream *graylog.Stream) error

AddStream adds a stream to the store.

func (*Store) AddStreamRule

func (store *Store) AddStreamRule(rule *graylog.StreamRule) error

AddStreamRule adds a stream rule.

func (*Store) AddUser

func (store *Store) AddUser(user *graylog.User) error

AddUser adds a user to the Store.

func (*Store) Authorize

func (store *Store) Authorize(user *graylog.User, scope string, args ...string) (bool, error)

Authorize authorizes the user.

func (*Store) DeleteIndexSet

func (store *Store) DeleteIndexSet(id string) error

DeleteIndexSet removes a index set from the Mock Server.

func (*Store) DeleteInput

func (store *Store) DeleteInput(id string) error

DeleteInput deletes an input from the store.

func (*Store) DeleteRole

func (store *Store) DeleteRole(name string) error

DeleteRole deletes a role from store.

func (*Store) DeleteStream

func (store *Store) DeleteStream(id string) error

DeleteStream removes a stream from the store.

func (*Store) DeleteStreamRule

func (store *Store) DeleteStreamRule(streamID, streamRuleID string) error

DeleteStreamRule deletes a stream rule.

func (*Store) DeleteUser

func (store *Store) DeleteUser(name string) error

DeleteUser removes a user from the Store.

func (*Store) GetDefaultIndexSetID

func (store *Store) GetDefaultIndexSetID() (string, error)

GetDefaultIndexSetID returns a default index set id.

func (*Store) GetEnabledStreams

func (store *Store) GetEnabledStreams() ([]graylog.Stream, int, error)

GetEnabledStreams returns all enabled streams.

func (*Store) GetIndexSet

func (store *Store) GetIndexSet(id string) (*graylog.IndexSet, error)

GetIndexSet returns an index set.

func (*Store) GetIndexSetStats

func (store *Store) GetIndexSetStats(id string) (*graylog.IndexSetStats, error)

GetIndexSetStats returns an index set stats.

func (*Store) GetIndexSetStatsMap

func (store *Store) GetIndexSetStatsMap() (map[string]graylog.IndexSetStats, error)

GetIndexSetStatsMap returns all of index set stats.

func (*Store) GetIndexSets

func (store *Store) GetIndexSets(skip, limit int) ([]graylog.IndexSet, int, error)

GetIndexSets returns a list of all index sets.

func (*Store) GetInput

func (store *Store) GetInput(id string) (*graylog.Input, error)

GetInput returns an input.

func (*Store) GetInputs

func (store *Store) GetInputs() ([]graylog.Input, int, error)

GetInputs returns inputs.

func (*Store) GetRole

func (store *Store) GetRole(name string) (*graylog.Role, error)

GetRole returns a Role. If no role with given name is found, returns nil and not returns an error.

func (*Store) GetRoles

func (store *Store) GetRoles() ([]graylog.Role, int, error)

GetRoles returns Roles.

func (*Store) GetStream

func (store *Store) GetStream(id string) (*graylog.Stream, error)

GetStream returns a stream.

func (*Store) GetStreamRule

func (store *Store) GetStreamRule(streamID, streamRuleID string) (*graylog.StreamRule, error)

GetStreamRule returns a stream rule.

func (*Store) GetStreamRules

func (store *Store) GetStreamRules(id string) ([]graylog.StreamRule, int, error)

GetStreamRules returns stream rules of the given stream.

func (*Store) GetStreams

func (store *Store) GetStreams() ([]graylog.Stream, int, error)

GetStreams returns a list of all streams.

func (*Store) GetTotalIndexSetStats

func (store *Store) GetTotalIndexSetStats() (*graylog.IndexSetStats, error)

GetTotalIndexSetStats returns all index set's statistics.

func (*Store) GetUser

func (store *Store) GetUser(username string) (*graylog.User, error)

GetUser returns a user. If the user is not found, this method returns nil and doesn't raise an error.

func (*Store) GetUserByAccessToken

func (store *Store) GetUserByAccessToken(token string) (*graylog.User, error)

GetUserByAccessToken returns a user name. If the user is not found, this method returns nil and doesn't raise an error.

func (*Store) GetUsers

func (store *Store) GetUsers() ([]graylog.User, error)

GetUsers returns users

func (*Store) HasIndexSet

func (store *Store) HasIndexSet(id string) (bool, error)

HasIndexSet returns whether the index set exists.

func (*Store) HasInput

func (store *Store) HasInput(id string) (bool, error)

HasInput returns whether the input exists.

func (*Store) HasRole

func (store *Store) HasRole(name string) (bool, error)

HasRole returns whether the role exists.

func (*Store) HasStream

func (store *Store) HasStream(id string) (bool, error)

HasStream returns whether the stream exists.

func (*Store) HasStreamRule

func (store *Store) HasStreamRule(streamID, streamRuleID string) (bool, error)

HasStreamRule returns whether the stream rule exists.

func (*Store) HasUser

func (store *Store) HasUser(username string) (bool, error)

HasUser returns whether the user exists.

func (*Store) IsConflictIndexPrefix

func (store *Store) IsConflictIndexPrefix(id, prefix string) (bool, error)

IsConflictIndexPrefix returns true if indexPrefix would conflict with an existing index set.

func (*Store) Load

func (store *Store) Load() error

Load reads Mock Server's data from a file.

func (*Store) MarshalJSON

func (store *Store) MarshalJSON() ([]byte, error)

MarshalJSON is the implementation of the json.Marshaler interface.

func (*Store) Save

func (store *Store) Save() error

Save writes Mock Server's data in a file for persistence.

func (*Store) SetDefaultIndexSetID

func (store *Store) SetDefaultIndexSetID(id string) error

SetDefaultIndexSetID sets a default index set id.

func (*Store) UnmarshalJSON

func (store *Store) UnmarshalJSON(b []byte) error

UnmarshalJSON is the implementation of the json.Unmarshaler interface.

func (*Store) UpdateIndexSet

func (store *Store) UpdateIndexSet(prms *graylog.IndexSetUpdateParams) (*graylog.IndexSet, error)

UpdateIndexSet updates an index set at the Mock Server.

func (*Store) UpdateInput

func (store *Store) UpdateInput(prms *graylog.InputUpdateParams) (*graylog.Input, error)

UpdateInput updates an input at the Store. Required: Title, Type, Attrs Allowed: Global, Node

func (*Store) UpdateRole

func (store *Store) UpdateRole(name string, prms *graylog.RoleUpdateParams) (*graylog.Role, error)

UpdateRole updates a role at the store.

func (*Store) UpdateStream

func (store *Store) UpdateStream(prms *graylog.StreamUpdateParams) (*graylog.Stream, error)

UpdateStream updates a stream at the store.

func (*Store) UpdateStreamRule

func (store *Store) UpdateStreamRule(prms *graylog.StreamRuleUpdateParams) error

UpdateStreamRule updates a stream rule.

func (*Store) UpdateUser

func (store *Store) UpdateUser(prms *graylog.UserUpdateParams) error

UpdateUser updates a user of the Store. "email", "permissions", "full_name", "password"

Jump to

Keyboard shortcuts

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