Documentation
¶
Index ¶
- Constants
- Variables
- func InitStores(db *gorm.DB)
- type AuthStore
- func (as *AuthStore) CreateGrant(ctx *logger.RequestContext, grant *model.Grant) error
- func (as *AuthStore) CreateUser(ctx *logger.RequestContext, user *model.User) error
- func (as *AuthStore) DeleteGrant(ctx *logger.RequestContext, userName, resourceType, resourceID string) error
- func (as *AuthStore) DeleteGrantByResourceID(ctx *logger.RequestContext, resourceID string) error
- func (as *AuthStore) DeleteGrantByUserName(ctx *logger.RequestContext, userName string) error
- func (as *AuthStore) DeleteUser(ctx *logger.RequestContext, userName string) error
- func (as *AuthStore) GetGrant(ctx *logger.RequestContext, userName, resourceType, resourceID string) (*model.Grant, error)
- func (as *AuthStore) GetLastGrant(ctx *logger.RequestContext) (model.Grant, error)
- func (as *AuthStore) GetLastUser(ctx *logger.RequestContext) (model.User, error)
- func (as *AuthStore) GetUserByName(ctx *logger.RequestContext, userName string) (model.User, error)
- func (as *AuthStore) HasAccessToResource(ctx *logger.RequestContext, resourceType string, resourceID string) bool
- func (as *AuthStore) ListGrant(ctx *logger.RequestContext, pk int64, maxKeys int, userName string) ([]model.Grant, error)
- func (as *AuthStore) ListUser(ctx *logger.RequestContext, pk int64, maxKey int) ([]model.User, error)
- func (as *AuthStore) UpdateUser(ctx *logger.RequestContext, userName, password string) error
- type AuthStoreInterface
- type ConcurrentFSCacheMap
- func (cm *ConcurrentFSCacheMap) Delete(key1, key2 string) error
- func (cm *ConcurrentFSCacheMap) Get(key1, key2 string) *model.FSCache
- func (cm *ConcurrentFSCacheMap) GetBatch(key string) []model.FSCache
- func (cm *ConcurrentFSCacheMap) Put(key string, value *model.FSCache)
- func (cm *ConcurrentFSCacheMap) Update(key string, value *model.FSCache) (has bool, err error)
- type DBFSCache
- func (f *DBFSCache) Add(value *model.FSCache) error
- func (f *DBFSCache) Delete(fsID, cacheID string) error
- func (f *DBFSCache) Get(fsID string, cacheID string) (*model.FSCache, error)
- func (f *DBFSCache) List(fsID, cacheID string) ([]model.FSCache, error)
- func (f *DBFSCache) ListNodes(fsIDs []string) ([]string, error)
- func (f *DBFSCache) Update(value *model.FSCache) (int64, error)
- type FileSystemStoreInterface
- type FilesystemStore
- func (fss *FilesystemStore) CreatFileSystem(fs *model.FileSystem) error
- func (fss *FilesystemStore) CreateFSCacheConfig(fsCacheConfig *model.FSCacheConfig) error
- func (fss *FilesystemStore) CreateLink(link *model.Link) error
- func (fss *FilesystemStore) DeleteFSCacheConfig(tx *gorm.DB, fsID string) error
- func (fss *FilesystemStore) DeleteFileSystem(tx *gorm.DB, id string) error
- func (fss *FilesystemStore) DeleteLinkWithFsID(tx *gorm.DB, fsID string) error
- func (fss *FilesystemStore) DeleteLinkWithFsIDAndFsPath(fsID, fsPath string) error
- func (fss *FilesystemStore) FsNameLinks(fsID string) ([]model.Link, error)
- func (fss *FilesystemStore) GetFSCacheConfig(fsID string) (model.FSCacheConfig, error)
- func (fss *FilesystemStore) GetFileSystemWithFsID(fsID string) (model.FileSystem, error)
- func (fss *FilesystemStore) GetLinkWithFsIDAndPath(fsID, fsPath string) ([]model.Link, error)
- func (fss *FilesystemStore) GetSimilarityAddressList(fsType string, ips []string) ([]model.FileSystem, error)
- func (fss *FilesystemStore) LinkWithFsIDAndFsPath(fsID, fsPath string) (model.Link, error)
- func (fss *FilesystemStore) ListFileSystem(limit int, userName, marker, fsName string) ([]model.FileSystem, error)
- func (fss *FilesystemStore) ListLink(limit int, marker, fsID string) ([]model.Link, error)
- func (fss *FilesystemStore) UpdateFSCacheConfig(fsCacheConfig *model.FSCacheConfig) error
- type FsCacheStoreInterface
- type MemFSCache
- func (mem *MemFSCache) Add(value *model.FSCache) error
- func (mem *MemFSCache) Delete(fsID, cacheID string) error
- func (mem *MemFSCache) Get(fsID string, cacheID string) (*model.FSCache, error)
- func (mem *MemFSCache) List(fsID, cacheID string) ([]model.FSCache, error)
- func (mem *MemFSCache) ListNodes(fsIDs []string) ([]string, error)
- func (mem *MemFSCache) Update(value *model.FSCache) (int64, error)
Constants ¶
View Source
const ( QueryEqualWithParam = " (%s = ?) " QueryLess = " (%s <= %s) " QueryGreater = " (%s >= %d) " QueryLikeWithParam = " (%s LIKE ?) " QueryInWithParam = " (%s IN (?)) " QueryNotInWithParam = " (%s NOT IN (?)) " QueryIsNull = " (%s IS NULL) " QueryAnd = " AND " QueryOr = " OR " CreatedAt = "created_at" UpdatedAt = "updated_at" Type = "type" ServerAddress = "server_address" State = "state" ID = "id" FsID = "fs_id" FsCacheID = "cache_id" FsPath = "fs_path" NodeName = "nodename" ClusterID = "cluster_id" Address = "address" UserName = "user_name" UserROOT = "root" ASC = "asc" DESC = "desc" )
Variables ¶
View Source
var ( DB *gorm.DB Filesystem FileSystemStoreInterface FsCache FsCacheStoreInterface Auth AuthStoreInterface )
Functions ¶
func InitStores ¶
Types ¶
type AuthStore ¶
type AuthStore struct {
// contains filtered or unexported fields
}
func (*AuthStore) CreateGrant ¶
func (*AuthStore) CreateUser ¶
func (*AuthStore) DeleteGrant ¶
func (as *AuthStore) DeleteGrant(ctx *logger.RequestContext, userName, resourceType, resourceID string) error
func (*AuthStore) DeleteGrantByResourceID ¶
func (as *AuthStore) DeleteGrantByResourceID(ctx *logger.RequestContext, resourceID string) error
func (*AuthStore) DeleteGrantByUserName ¶
func (as *AuthStore) DeleteGrantByUserName(ctx *logger.RequestContext, userName string) error
func (*AuthStore) DeleteUser ¶
func (as *AuthStore) DeleteUser(ctx *logger.RequestContext, userName string) error
func (*AuthStore) GetLastGrant ¶
func (*AuthStore) GetLastUser ¶
func (*AuthStore) GetUserByName ¶
func (*AuthStore) HasAccessToResource ¶
func (*AuthStore) UpdateUser ¶
func (as *AuthStore) UpdateUser(ctx *logger.RequestContext, userName, password string) error
type AuthStoreInterface ¶
type AuthStoreInterface interface { // user CreateUser(ctx *logger.RequestContext, user *model.User) error UpdateUser(ctx *logger.RequestContext, userName, password string) error ListUser(ctx *logger.RequestContext, pk int64, maxKey int) ([]model.User, error) DeleteUser(ctx *logger.RequestContext, userName string) error GetUserByName(ctx *logger.RequestContext, userName string) (model.User, error) GetLastUser(ctx *logger.RequestContext) (model.User, error) // grant CreateGrant(ctx *logger.RequestContext, grant *model.Grant) error DeleteGrant(ctx *logger.RequestContext, userName, resourceType, resourceID string) error GetGrant(ctx *logger.RequestContext, userName, resourceType, resourceID string) (*model.Grant, error) HasAccessToResource(ctx *logger.RequestContext, resourceType string, resourceID string) bool DeleteGrantByUserName(ctx *logger.RequestContext, userName string) error DeleteGrantByResourceID(ctx *logger.RequestContext, resourceID string) error ListGrant(ctx *logger.RequestContext, pk int64, maxKeys int, userName string) ([]model.Grant, error) GetLastGrant(ctx *logger.RequestContext) (model.Grant, error) }
type ConcurrentFSCacheMap ¶
func (*ConcurrentFSCacheMap) Delete ¶
func (cm *ConcurrentFSCacheMap) Delete(key1, key2 string) error
func (*ConcurrentFSCacheMap) Get ¶
func (cm *ConcurrentFSCacheMap) Get(key1, key2 string) *model.FSCache
func (*ConcurrentFSCacheMap) GetBatch ¶
func (cm *ConcurrentFSCacheMap) GetBatch(key string) []model.FSCache
type DBFSCache ¶
type DBFSCache struct {
// contains filtered or unexported fields
}
type FileSystemStoreInterface ¶
type FileSystemStoreInterface interface { // filesystem CreatFileSystem(fs *model.FileSystem) error GetFileSystemWithFsID(fsID string) (model.FileSystem, error) DeleteFileSystem(tx *gorm.DB, id string) error ListFileSystem(limit int, userName, marker, fsName string) ([]model.FileSystem, error) GetSimilarityAddressList(fsType string, ips []string) ([]model.FileSystem, error) // link CreateLink(link *model.Link) error FsNameLinks(fsID string) ([]model.Link, error) LinkWithFsIDAndFsPath(fsID, fsPath string) (model.Link, error) DeleteLinkWithFsID(tx *gorm.DB, id string) error DeleteLinkWithFsIDAndFsPath(fsID, fsPath string) error ListLink(limit int, marker, fsID string) ([]model.Link, error) GetLinkWithFsIDAndPath(fsID, fsPath string) ([]model.Link, error) // fs_cache_config CreateFSCacheConfig(fsCacheConfig *model.FSCacheConfig) error UpdateFSCacheConfig(fsCacheConfig *model.FSCacheConfig) error DeleteFSCacheConfig(tx *gorm.DB, fsID string) error GetFSCacheConfig(fsID string) (model.FSCacheConfig, error) }
type FilesystemStore ¶
type FilesystemStore struct {
// contains filtered or unexported fields
}
func (*FilesystemStore) CreatFileSystem ¶
func (fss *FilesystemStore) CreatFileSystem(fs *model.FileSystem) error
func (*FilesystemStore) CreateFSCacheConfig ¶
func (fss *FilesystemStore) CreateFSCacheConfig(fsCacheConfig *model.FSCacheConfig) error
func (*FilesystemStore) CreateLink ¶
func (fss *FilesystemStore) CreateLink(link *model.Link) error
func (*FilesystemStore) DeleteFSCacheConfig ¶
func (fss *FilesystemStore) DeleteFSCacheConfig(tx *gorm.DB, fsID string) error
func (*FilesystemStore) DeleteFileSystem ¶
func (fss *FilesystemStore) DeleteFileSystem(tx *gorm.DB, id string) error
func (*FilesystemStore) DeleteLinkWithFsID ¶
func (fss *FilesystemStore) DeleteLinkWithFsID(tx *gorm.DB, fsID string) error
DeleteLinkWithFsID delete all filesystem links associated with fsID
func (*FilesystemStore) DeleteLinkWithFsIDAndFsPath ¶
func (fss *FilesystemStore) DeleteLinkWithFsIDAndFsPath(fsID, fsPath string) error
DeleteLinkWithFsIDAndFsPath delete a file system link
func (*FilesystemStore) FsNameLinks ¶
func (fss *FilesystemStore) FsNameLinks(fsID string) ([]model.Link, error)
func (*FilesystemStore) GetFSCacheConfig ¶
func (fss *FilesystemStore) GetFSCacheConfig(fsID string) (model.FSCacheConfig, error)
func (*FilesystemStore) GetFileSystemWithFsID ¶
func (fss *FilesystemStore) GetFileSystemWithFsID(fsID string) (model.FileSystem, error)
func (*FilesystemStore) GetLinkWithFsIDAndPath ¶
func (fss *FilesystemStore) GetLinkWithFsIDAndPath(fsID, fsPath string) ([]model.Link, error)
func (*FilesystemStore) GetSimilarityAddressList ¶
func (fss *FilesystemStore) GetSimilarityAddressList(fsType string, ips []string) ([]model.FileSystem, error)
GetSimilarityAddressList find fs where have same type and serverAddress
func (*FilesystemStore) LinkWithFsIDAndFsPath ¶
func (fss *FilesystemStore) LinkWithFsIDAndFsPath(fsID, fsPath string) (model.Link, error)
func (*FilesystemStore) ListFileSystem ¶
func (fss *FilesystemStore) ListFileSystem(limit int, userName, marker, fsName string) ([]model.FileSystem, error)
ListFileSystem get file systems with marker and limit sort by create_at desc
func (*FilesystemStore) UpdateFSCacheConfig ¶
func (fss *FilesystemStore) UpdateFSCacheConfig(fsCacheConfig *model.FSCacheConfig) error
type FsCacheStoreInterface ¶
type FsCacheStoreInterface interface { Add(value *model.FSCache) error Get(fsID string, cacheID string) (*model.FSCache, error) Delete(fsID, cacheID string) error List(fsID, cacheID string) ([]model.FSCache, error) ListNodes(fsID []string) ([]string, error) Update(value *model.FSCache) (int64, error) }
FsCacheStoreInterface currently has two implementations: DB and memory use newMemFSCache() or newDBFSCache(db *gorm.DB) to initiate
Source Files
¶
Click to show internal directories.
Click to hide internal directories.