Documentation ¶
Overview ¶
Package store implements the go-micro store interface
Package store implements the go-micro store interface ¶
Package store implements the go-micro store interface ¶
Package store implements the go-micro store interface
Index ¶
- Variables
- func New(cfg *config.Config) settings.Manager
- type CachedMDC
- func (c *CachedMDC) Delete(ctx context.Context, id string) error
- func (c *CachedMDC) Init(ctx context.Context, id string) error
- func (c *CachedMDC) MakeDirIfNotExist(ctx context.Context, id string) error
- func (c *CachedMDC) ReadDir(ctx context.Context, id string) ([]string, error)
- func (c *CachedMDC) SimpleDownload(ctx context.Context, id string) ([]byte, error)
- func (c *CachedMDC) SimpleUpload(ctx context.Context, id string, content []byte) error
- type MetadataClient
- type Store
- func (s *Store) AddSettingToBundle(bundleID string, setting *settingsmsg.Setting) (*settingsmsg.Setting, error)
- func (s *Store) Init()
- func (s *Store) ListBundles(bundleType settingsmsg.Bundle_Type, bundleIDs []string) ([]*settingsmsg.Bundle, error)
- func (s *Store) ListPermissionsByResource(resource *settingsmsg.Resource, roleIDs []string) ([]*settingsmsg.Permission, error)
- func (s *Store) ListRoleAssignments(accountUUID string) ([]*settingsmsg.UserRoleAssignment, error)
- func (s *Store) ListValues(bundleID, accountUUID string) ([]*settingsmsg.Value, error)
- func (s *Store) ReadBundle(bundleID string) (*settingsmsg.Bundle, error)
- func (s *Store) ReadPermissionByID(permissionID string, roleIDs []string) (*settingsmsg.Permission, error)
- func (s *Store) ReadPermissionByName(name string, roleIDs []string) (*settingsmsg.Permission, error)
- func (s *Store) ReadSetting(settingID string) (*settingsmsg.Setting, error)
- func (s *Store) ReadValue(valueID string) (*settingsmsg.Value, error)
- func (s *Store) ReadValueByUniqueIdentifiers(accountUUID, settingID string) (*settingsmsg.Value, error)
- func (s *Store) RemoveRoleAssignment(assignmentID string) error
- func (s *Store) RemoveSettingFromBundle(bundleID string, settingID string) error
- func (s *Store) WriteBundle(record *settingsmsg.Bundle) (*settingsmsg.Bundle, error)
- func (s *Store) WriteRoleAssignment(accountUUID, roleID string) (*settingsmsg.UserRoleAssignment, error)
- func (s *Store) WriteValue(value *settingsmsg.Value) (*settingsmsg.Value, error)
Constants ¶
This section is empty.
Variables ¶
var (
// Name is the default name for the settings store
Name = "ocis-settings"
)
Functions ¶
Types ¶
type CachedMDC ¶
type CachedMDC struct {
// contains filtered or unexported fields
}
CachedMDC is cache for the metadataclient
func (*CachedMDC) MakeDirIfNotExist ¶
MakeDirIfNotExist invalidates the cache
func (*CachedMDC) SimpleDownload ¶
SimpleDownload caches the answer from SimpleDownload or returns the cached one
type MetadataClient ¶
type MetadataClient interface { SimpleDownload(ctx context.Context, id string) ([]byte, error) SimpleUpload(ctx context.Context, id string, content []byte) error Delete(ctx context.Context, id string) error ReadDir(ctx context.Context, id string) ([]string, error) MakeDirIfNotExist(ctx context.Context, id string) error Init(ctx context.Context, id string) error }
MetadataClient is the interface to talk to metadata service
func NewMetadataClient ¶
func NewMetadataClient(cfg config.Metadata) MetadataClient
NewMetadataClient returns the MetadataClient
type Store ¶
Store interacts with the filesystem to manage settings information
func (*Store) AddSettingToBundle ¶
func (s *Store) AddSettingToBundle(bundleID string, setting *settingsmsg.Setting) (*settingsmsg.Setting, error)
AddSettingToBundle adds the given setting to the bundle with the given bundleID.
func (*Store) ListBundles ¶
func (s *Store) ListBundles(bundleType settingsmsg.Bundle_Type, bundleIDs []string) ([]*settingsmsg.Bundle, error)
ListBundles returns all bundles in the dataPath folder that match the given type.
func (*Store) ListPermissionsByResource ¶
func (s *Store) ListPermissionsByResource(resource *settingsmsg.Resource, roleIDs []string) ([]*settingsmsg.Permission, error)
ListPermissionsByResource collects all permissions from the provided roleIDs that match the requested resource
func (*Store) ListRoleAssignments ¶
func (s *Store) ListRoleAssignments(accountUUID string) ([]*settingsmsg.UserRoleAssignment, error)
ListRoleAssignments loads and returns all role assignments matching the given assignment identifier.
func (*Store) ListValues ¶
func (s *Store) ListValues(bundleID, accountUUID string) ([]*settingsmsg.Value, error)
ListValues reads all values that match the given bundleId and accountUUID. If the bundleId is empty, it's ignored for filtering. If the accountUUID is empty, only values with empty accountUUID are returned. If the accountUUID is not empty, values with an empty or with a matching accountUUID are returned.
func (*Store) ReadBundle ¶
func (s *Store) ReadBundle(bundleID string) (*settingsmsg.Bundle, error)
ReadBundle tries to find a bundle by the given id from the metadata service
func (*Store) ReadPermissionByID ¶
func (s *Store) ReadPermissionByID(permissionID string, roleIDs []string) (*settingsmsg.Permission, error)
ReadPermissionByID finds the permission in the roles, specified by the provided roleIDs
func (*Store) ReadPermissionByName ¶
func (s *Store) ReadPermissionByName(name string, roleIDs []string) (*settingsmsg.Permission, error)
ReadPermissionByName finds the permission in the roles, specified by the provided roleIDs
func (*Store) ReadSetting ¶
func (s *Store) ReadSetting(settingID string) (*settingsmsg.Setting, error)
ReadSetting tries to find a setting by the given id from the metadata service
func (*Store) ReadValue ¶
func (s *Store) ReadValue(valueID string) (*settingsmsg.Value, error)
ReadValue tries to find a value by the given valueId within the dataPath
func (*Store) ReadValueByUniqueIdentifiers ¶
func (s *Store) ReadValueByUniqueIdentifiers(accountUUID, settingID string) (*settingsmsg.Value, error)
ReadValueByUniqueIdentifiers tries to find a value given a set of unique identifiers
func (*Store) RemoveRoleAssignment ¶
RemoveRoleAssignment deletes the given role assignment from the existing assignments of the respective account.
func (*Store) RemoveSettingFromBundle ¶
RemoveSettingFromBundle removes the setting from the bundle with the given ids.
func (*Store) WriteBundle ¶
func (s *Store) WriteBundle(record *settingsmsg.Bundle) (*settingsmsg.Bundle, error)
WriteBundle sends the givens record to the metadataclient. returns `record` for legacy reasons
func (*Store) WriteRoleAssignment ¶
func (s *Store) WriteRoleAssignment(accountUUID, roleID string) (*settingsmsg.UserRoleAssignment, error)
WriteRoleAssignment appends the given role assignment to the existing assignments of the respective account.
func (*Store) WriteValue ¶
func (s *Store) WriteValue(value *settingsmsg.Value) (*settingsmsg.Value, error)
WriteValue writes the given value into a file within the dataPath