Documentation ¶
Index ¶
- Variables
- func GetKeyHash(key string) string
- func GetOAuthKey(mattermostUserID string) string
- func GetProjectKey(projectID, mattermostUserID string) string
- func GetProjectListMapKey() string
- func GetSubscriptionKey(mattermostUserID, projectID, channelID, eventType string) string
- func GetSubscriptionListMapKey() string
- func IsValidUserKey(key string) (string, bool)
- type KVStore
- type LinkStore
- type OAuthStore
- type ProjectList
- type ProjectListMap
- type Store
- func (s *Store) AtomicModify(key string, modify func(initialValue []byte) ([]byte, error)) error
- func (s *Store) AtomicModifyWithOptions(key string, ...) error
- func (s *Store) Delete(key string) error
- func (s *Store) DeleteProject(project *serializers.ProjectDetails) error
- func (s *Store) DeleteSubscription(subscription *serializers.SubscriptionDetails) error
- func (s *Store) DeleteUser(mattermostUserID string) (bool, error)
- func (s *Store) DeleteUserTokenOnEncryptionSecretChange() error
- func (s *Store) Ensure(key string, newValue []byte) ([]byte, error)
- func (s *Store) GetAllProjects(userID string) ([]serializers.ProjectDetails, error)
- func (s *Store) GetAllSubscriptions(userID string) ([]*serializers.SubscriptionDetails, error)
- func (s *Store) GetProject() (*ProjectList, error)
- func (s *Store) GetSubscriptionList() (*SubscriptionList, error)
- func (s *Store) Load(key string) ([]byte, error)
- func (s *Store) LoadJSON(key string, v interface{}) (returnErr error)
- func (s *Store) LoadUser(mattermostUserID string) (*serializers.User, error)
- func (s *Store) Store(key string, data []byte) error
- func (s *Store) StoreJSON(key string, v interface{}) (returnErr error)
- func (s *Store) StoreOAuthState(mattermostUserID, state string) error
- func (s *Store) StoreProject(project *serializers.ProjectDetails) error
- func (s *Store) StoreSubscription(subscription *serializers.SubscriptionDetails) error
- func (s *Store) StoreTTL(key string, data []byte, ttlSeconds int64) error
- func (s *Store) StoreUser(user *serializers.User) error
- func (s *Store) StoreWithOptions(key string, value []byte, opts model.PluginKVSetOptions) (bool, error)
- func (s *Store) VerifyOAuthState(mattermostUserID, state string) error
- type SubscriptionList
- type SubscriptionListMap
- type SubscriptionStore
- type UserStore
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found")
Functions ¶
func GetKeyHash ¶
GetKeyHash can be used to create a hash from a string
func GetOAuthKey ¶
func GetProjectKey ¶
func GetProjectListMapKey ¶
func GetProjectListMapKey() string
func GetSubscriptionKey ¶ added in v0.2.0
func GetSubscriptionListMapKey ¶ added in v0.2.0
func GetSubscriptionListMapKey() string
func IsValidUserKey ¶ added in v0.2.1
Types ¶
type KVStore ¶ added in v1.0.0
type KVStore interface { OAuthStore UserStore LinkStore SubscriptionStore DeleteUserTokenOnEncryptionSecretChange() error }
type LinkStore ¶ added in v1.0.0
type LinkStore interface { StoreProject(project *serializers.ProjectDetails) error GetProject() (*ProjectList, error) GetAllProjects(userID string) ([]serializers.ProjectDetails, error) DeleteProject(project *serializers.ProjectDetails) error }
type OAuthStore ¶ added in v1.0.0
type ProjectList ¶
type ProjectList struct {
ByMattermostUserID map[string]ProjectListMap
}
func NewProjectList ¶
func NewProjectList() *ProjectList
func ProjectListFromJSON ¶
func ProjectListFromJSON(bytes []byte) (*ProjectList, error)
func (*ProjectList) AddProject ¶
func (projectList *ProjectList) AddProject(userID string, project *serializers.ProjectDetails)
func (*ProjectList) DeleteProjectByKey ¶
func (projectList *ProjectList) DeleteProjectByKey(userID, projectKey string)
type ProjectListMap ¶
type ProjectListMap map[string]serializers.ProjectDetails
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) AtomicModify ¶
AtomicModify calls AtomicModifyWithOptions with nil PluginKVSetOptions to atomically modify a value in KVStore and set it for an indefinite time See AtomicModifyWithOptions for more info
func (*Store) AtomicModifyWithOptions ¶
func (s *Store) AtomicModifyWithOptions(key string, modify func(initialValue []byte) ([]byte, *model.PluginKVSetOptions, error)) error
AtomicModifyWithOptions modifies the value for a key in KVStore, only if the initial value is not changed while attempting to modify it. To avoid race conditions, we retry the modification multiple times after waiting for a fixed wait interval. input: kv store key and a modify function which takes initial value and returns final value with PluginKVSetOptions and error. returns: nil for a successful update and error if the update is unsuccessful or the retry limit reached.
func (*Store) DeleteProject ¶
func (s *Store) DeleteProject(project *serializers.ProjectDetails) error
func (*Store) DeleteSubscription ¶ added in v0.2.0
func (s *Store) DeleteSubscription(subscription *serializers.SubscriptionDetails) error
func (*Store) DeleteUserTokenOnEncryptionSecretChange ¶ added in v1.0.0
func (*Store) Ensure ¶
Ensure makes sure the initial value for a key is set to the value provided, if it does not already exist Returns the value set for the key in kv-store and error
func (*Store) GetAllProjects ¶
func (s *Store) GetAllProjects(userID string) ([]serializers.ProjectDetails, error)
func (*Store) GetAllSubscriptions ¶ added in v0.2.0
func (s *Store) GetAllSubscriptions(userID string) ([]*serializers.SubscriptionDetails, error)
func (*Store) GetProject ¶
func (s *Store) GetProject() (*ProjectList, error)
func (*Store) GetSubscriptionList ¶ added in v1.0.0
func (s *Store) GetSubscriptionList() (*SubscriptionList, error)
func (*Store) LoadJSON ¶
LoadJSON loads a json value stored in the KVStore using StoreJSON unmarshalling it to an interface using json.Unmarshal
func (*Store) LoadUser ¶
func (s *Store) LoadUser(mattermostUserID string) (*serializers.User, error)
func (*Store) StoreJSON ¶
StoreJSON stores a json value from an interface to KVStore after marshaling it using json.Marshal
func (*Store) StoreOAuthState ¶
func (*Store) StoreProject ¶
func (s *Store) StoreProject(project *serializers.ProjectDetails) error
func (*Store) StoreSubscription ¶ added in v0.2.0
func (s *Store) StoreSubscription(subscription *serializers.SubscriptionDetails) error
func (*Store) StoreWithOptions ¶
func (*Store) VerifyOAuthState ¶
type SubscriptionList ¶ added in v0.2.0
type SubscriptionList struct {
ByMattermostUserID map[string]SubscriptionListMap
}
func NewSubscriptionList ¶ added in v0.2.0
func NewSubscriptionList() *SubscriptionList
func SubscriptionListFromJSON ¶ added in v0.2.0
func SubscriptionListFromJSON(bytes []byte) (*SubscriptionList, error)
func (*SubscriptionList) AddSubscription ¶ added in v0.2.0
func (subscriptionList *SubscriptionList) AddSubscription(userID string, subscription *serializers.SubscriptionDetails)
func (*SubscriptionList) DeleteSubscriptionByKey ¶ added in v0.2.0
func (subscriptionList *SubscriptionList) DeleteSubscriptionByKey(userID, subscriptionKey string)
type SubscriptionListMap ¶ added in v0.2.0
type SubscriptionListMap map[string]serializers.SubscriptionDetails
type SubscriptionStore ¶ added in v1.0.0
type SubscriptionStore interface { StoreSubscription(subscription *serializers.SubscriptionDetails) error GetSubscriptionList() (*SubscriptionList, error) GetAllSubscriptions(userID string) ([]*serializers.SubscriptionDetails, error) DeleteSubscription(subscription *serializers.SubscriptionDetails) error }