Documentation ¶
Index ¶
- Constants
- func Hashkey(globalNamespace string, appID apps.AppID, userID, appNamespace, key string) (string, error)
- func ParseHashkey(key string) (globalNamespace string, appID apps.AppID, userID, appNamespace, idhash string, ...)
- func WithAppID(appID apps.AppID) func(string, apps.AppID, string, string, string) bool
- func WithNamespace(namespace string) func(string, apps.AppID, string, string, string) bool
- func WithPrefix(prefix string) func(string, apps.AppID, string, string, string) bool
- func WithUserID(userID string) func(string, apps.AppID, string, string, string) bool
- type AppKVStore
- type AppStore
- type FilterOpt
- type KVDebugAppInfo
- type KVDebugInfo
- type ManifestStore
- type OAuth2Store
- type Service
- type SessionStore
- type StoredSubscriptions
- type Subscription
- type SubscriptionStore
Constants ¶
View Source
const ( EnabledAppsOnly = FilterOpt(false) AllApps = FilterOpt(true) )
View Source
const ( // KVAppPrefix is the Apps global namespace. KVAppPrefix = ".k" // KVUserPrefix is the global namespace used to store user // records. KVUserPrefix = ".u" // KVUserPrefix is the key to store OAuth2 user // records. KVUserKey = "oauth2_user" // KVOAuth2StatePrefix is the global namespace used to store OAuth2 // ephemeral state data. KVOAuth2StatePrefix = ".o" // KVSubPrefix is used for keys storing subscriptions. KVSubPrefix = "sub." // KVInstalledAppPrefix is used to store App records. KVInstalledAppPrefix = "app." // KVLocalManifestPrefix is used to store locally-listed manifests. KVLocalManifestPrefix = "man." KVTokenPrefix = ".t" KVDebugPrefix = ".debug." // KVCallOnceKey and KVClusterMutexKey are used for invoking App Calls once, // usually upon a Mattermost instance startup. KVCallOnceKey = "CallOnce" KVClusterMutexKey = "Cluster_Mutex" )
KV namespace
Keys starting with a '.' are reserved for app-specific keys in the "hashkey" format. Hashkeys have the following format (see service_test.go#TestHashkey for examples):
- global prefix of ".X" where X is exactly 1 byte (2 bytes)
- bot user ID (26 bytes)
- app-specific prefix, limited to 2 non-space ASCII characters, right-filled with ' ' to 2 bytes.
- app-specific key hash: 16 bytes, ascii85 (20 bytes)
All other keys must start with an ASCII letter. '.' is usually used as the terminator since it is not used in the base64 representation.
View Source
const (
ListKeysPerPage = 1000
)
Variables ¶
This section is empty.
Functions ¶
func ParseHashkey ¶ added in v1.0.0
func WithNamespace ¶ added in v1.2.0
func WithPrefix ¶ added in v1.2.0
Types ¶
type AppKVStore ¶ added in v0.3.0
type KVDebugAppInfo ¶ added in v1.2.0
type KVDebugAppInfo struct { AppKVCount int AppKVCountByNamespace map[string]int AppKVCountByUserID map[string]int TokenCount int UserCount int }
func (KVDebugAppInfo) Total ¶ added in v1.2.0
func (i KVDebugAppInfo) Total() int
type KVDebugInfo ¶ added in v1.2.0
type ManifestStore ¶
type ManifestStore interface { config.Configurable StoreLocal(*incoming.Request, apps.Manifest) error Get(apps.AppID) (*apps.Manifest, error) GetFromS3(appID apps.AppID, version apps.AppVersion) (*apps.Manifest, error) AsMap() map[apps.AppID]apps.Manifest DeleteLocal(*incoming.Request, apps.AppID) error }
type OAuth2Store ¶ added in v0.3.0
type Service ¶
type Service struct { App AppStore Subscription SubscriptionStore Manifest ManifestStore AppKV AppKVStore OAuth2 OAuth2Store Session SessionStore // contains filtered or unexported fields }
func MakeService ¶ added in v1.0.0
func (*Service) GetDebugKVInfo ¶ added in v1.2.0
func (s *Service) GetDebugKVInfo(log utils.Logger) (*KVDebugInfo, error)
func (*Service) ListHashKeys ¶ added in v1.2.0
type SessionStore ¶ added in v1.0.0
type SessionStore interface { Get(_ apps.AppID, userID string) (*model.Session, error) ListForApp(apps.AppID) ([]*model.Session, error) ListForUser(_ *incoming.Request, userID string) ([]*model.Session, error) Save(_ apps.AppID, userID string, session *model.Session) error Delete(_ apps.AppID, userID string) error DeleteAllForApp(*incoming.Request, apps.AppID) error DeleteAllForUser(_ *incoming.Request, userID string) error }
type StoredSubscriptions ¶ added in v1.2.0
type StoredSubscriptions struct { Event apps.Event Subscriptions []Subscription }
type Subscription ¶ added in v1.2.0
type SubscriptionStore ¶
type SubscriptionStore interface { Get(apps.Event) ([]Subscription, error) List() ([]StoredSubscriptions, error) Save(apps.Event, []Subscription) error }
SubscriptionStore stores the complete (for all apps) list of subscriptions for each "scope", everything in apps.Subscription, but the Call - the subject, and the optional team/channel IDs.
Click to show internal directories.
Click to hide internal directories.