Documentation
¶
Overview ¶
Package filestore contains functionality to store Emitto rule files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGCSClient ¶
NewGCSClient initializes a new Google Cloud Storage Client. Follow these instructions to set up application credentials: https://cloud.google.com/docs/authentication/production#obtaining_and_providing_service_account_credentials_manually.
func RunTestSuite ¶
RunTestSuite runs all generic store tests.
The tests use the provided builder to instantiate a FileStore. The builder is expected to always return a valid Store.
Types ¶
type FileStore ¶
type FileStore interface { // AddRuleFile creates a new rule file at the specified path. AddRuleFile(ctx context.Context, path string, rules []byte) error // GetRuleFile retrieves an existing rule file by path. GetRuleFile(ctx context.Context, path string) ([]byte, error) // DeleteRuleFile removes an existing rule file by path. DeleteRuleFile(ctx context.Context, path string) error }
FileStore represents a Emitto file store.
type GCSFileStore ¶
type GCSFileStore struct {
// contains filtered or unexported fields
}
GCSFileStore is a Google Cloud Storage implementation of a FileStore.
func NewGCSFileStore ¶
func NewGCSFileStore(bucket string, client *storage.Client) *GCSFileStore
NewGCSFileStore returns a new GCSFileStore.
func (*GCSFileStore) AddRuleFile ¶
AddRuleFile uploads a rule file to GCS.
func (*GCSFileStore) DeleteRuleFile ¶
func (s *GCSFileStore) DeleteRuleFile(ctx context.Context, ruleFile string) error
DeleteRuleFile removes a rule file from GCS.
func (*GCSFileStore) GetRuleFile ¶
GetRuleFile returns a rule file from GCS.
type MemoryFileStore ¶
type MemoryFileStore struct {
// contains filtered or unexported fields
}
MemoryFileStore a memory implementation of a FileStore.
func NewMemoryFileStore ¶
func NewMemoryFileStore() *MemoryFileStore
NewMemoryFileStore returns a MemoryFileStore.
func (*MemoryFileStore) AddRuleFile ¶
AddRuleFile stores a rule file in the filestore.
func (*MemoryFileStore) DeleteRuleFile ¶
func (s *MemoryFileStore) DeleteRuleFile(ctx context.Context, path string) error
DeleteRuleFile removes a rule file from the filestore.
func (*MemoryFileStore) GetRuleFile ¶
GetRuleFile retrieves a rule file from the filestore.