Documentation ¶
Index ¶
- Variables
- func CreateProject(ctx context.Context, bok *bokchoy.Bokchoy) ...
- func CreateUserResource(ctx context.Context, bok *bokchoy.Bokchoy) ...
- func DeleteUserResource(ctx context.Context, bok *bokchoy.Bokchoy) ...
- func GetMetrics(ucache *UserResourceCache, pcache *ProjectResourceCache, ...) func(p operations.GetMetricsParams) middleware.Responder
- func GetPing(cfg config.Configuration) ...
- func GetProjectResource(cache *ProjectResourceCache) func(params operations.GetProjectsIDParams) middleware.Responder
- func GetProjects(cache *ProjectResourceCache) func(params operations.GetProjectsParams) middleware.Responder
- func GetTask(ctx context.Context, bok *bokchoy.Bokchoy) func(params operations.GetTasksTypeIDParams) middleware.Responder
- func GetUserResource(ucache *UserResourceCache, pcache *ProjectResourceCache) func(params operations.GetUsersIDParams) middleware.Responder
- func GetUsers(ucache *UserResourceCache, pcache *ProjectResourceCache) func(params operations.GetUsersParams) middleware.Responder
- func NewCustomResponder(r *http.Request, h http.Handler) middleware.Responder
- func UpdateProject(ctx context.Context, bok *bokchoy.Bokchoy) ...
- func UpdateUserResource(ctx context.Context, bok *bokchoy.Bokchoy) ...
- type CustomResponder
- type ProjectResourceCache
- type ResponseError
- type SystemInfoCache
- type UserResourceCache
Constants ¶
This section is empty.
Variables ¶
var ( // PathProject is the top-leve directory in which directories of active projects are located. PathProject string = "/project" // QueueSetProject is the queue name for setting project resources. QueueSetProject string = "tasks.setProject" // QueueSetUser is the queue name for setting user resources. QueueSetUser string = "tasks.setUser" // QueueDelUser is the queue name for deleting qtree of user's home directory. QueueDelUser string = "tasks.delUser" // DefaultHomeStorageSystem is the name of the default storage system used for user's home directory DefaultHomeStorageSystem = "netapp" )
var ( // NotImplementedError indicates the implementation of the handler is not implemented yet. NotImplementedError int64 = 100 // RoleSettingError indicates error when setting the Role/ACL on the underlying filer. RoleSettingError int64 = 101 // RoleGettingError indicates error when getting the Role/ACL from the underlying filer. RoleGettingError int64 = 102 // QuotaGettingError indicates error when getting the quota limitation and usage from the underlying filer. QuotaGettingError int64 = 103 // UserLookupError indicates error when looking up the user in the system. UserLookupError int64 = 104 // MemberOfGettingError indicates error when looking up user's membership on all active projects. MemberOfGettingError int64 = 105 // TaskQueueError indicates the request is failed to be added to the task queue for resource setting. TaskQueueError int64 = 106 )
Error code definitions.
Functions ¶
func CreateProject ¶
func CreateProject(ctx context.Context, bok *bokchoy.Bokchoy) func(params operations.PostProjectsParams, principle *models.Principle) middleware.Responder
CreateProject handles the project creation on filer by formulating it into an. asynchronous task.
task configuration: - canceled if running more than 12 hours. - no retry. - result is kept for 7 days.
func CreateUserResource ¶
func CreateUserResource(ctx context.Context, bok *bokchoy.Bokchoy) func(params operations.PostUsersParams, principle *models.Principle) middleware.Responder
CreateUserResource handles the request for creating user home space on the filer by formulating the request into a asynchronous task.
task configuration: - canceled if running more than 1 hour. - no retry. - result is kept for 7 days.
func DeleteUserResource ¶
func DeleteUserResource(ctx context.Context, bok *bokchoy.Bokchoy) func(params operations.DeleteUsersIDParams, principle *models.Principle) middleware.Responder
DeleteUserResource handles the request for deleting user home qtree from the filer by formulating the request into a asynchronous task.
If there are still data in the qtree, it returns 400 error immediately.
task configuration: - canceled if running more than 1 hour. - no retry. - result is kept for 7 days.
func GetMetrics ¶
func GetMetrics(ucache *UserResourceCache, pcache *ProjectResourceCache, scache *SystemInfoCache) func(p operations.GetMetricsParams) middleware.Responder
GetMetrics handles the metrics request with the Prometheus handler
func GetPing ¶
func GetPing(cfg config.Configuration) func(params operations.GetPingParams, principle *models.Principle) middleware.Responder
GetPing returns dummy string for health check, including the authentication.
func GetProjectResource ¶
func GetProjectResource(cache *ProjectResourceCache) func(params operations.GetProjectsIDParams) middleware.Responder
GetProjectResource implements retrival of project resource (i.e. storage and members).
func GetProjects ¶
func GetProjects(cache *ProjectResourceCache) func(params operations.GetProjectsParams) middleware.Responder
GetProjects implements retrival of resources of all projects implemented on the filer, under path of `handler.PathProject`.
func GetTask ¶
func GetTask(ctx context.Context, bok *bokchoy.Bokchoy) func(params operations.GetTasksTypeIDParams) middleware.Responder
GetTask retrieves task status from one or multiple queues depending on the task type.
func GetUserResource ¶
func GetUserResource(ucache *UserResourceCache, pcache *ProjectResourceCache) func(params operations.GetUsersIDParams) middleware.Responder
GetUserResource implements retrival of file resource for a user (i.e. storage).
func GetUsers ¶
func GetUsers(ucache *UserResourceCache, pcache *ProjectResourceCache) func(params operations.GetUsersParams) middleware.Responder
GetUsers implements retrival of resources of all system users with UID >= 1000.
func NewCustomResponder ¶
func UpdateProject ¶
func UpdateProject(ctx context.Context, bok *bokchoy.Bokchoy) func(params operations.PatchProjectsIDParams, principle *models.Principle) middleware.Responder
UpdateProject implements the project update on filer systems. Those updates can be one of the following:
- update project quota. - set project members.
The corresponding project directory on the filer should exist in advance.
task configuration: - canceled if running more than 12 hours. - no retry. - result is kept for 7 days.
func UpdateUserResource ¶
func UpdateUserResource(ctx context.Context, bok *bokchoy.Bokchoy) func(params operations.PatchUsersIDParams, principle *models.Principle) middleware.Responder
UpdateUserResource handles the request for updating user home space quota on the filer by formulating the request into a asynchronous task.
task configuration: - canceled if running more than 1 hour. - no retry. - result is kept for 7 days.
Types ¶
type CustomResponder ¶
type CustomResponder func(http.ResponseWriter, runtime.Producer)
This trick of integrating promhttp handler with swagger server is taken from the blog: https://www.kaznacheev.me/posts/en/go_swagger_tricks/
func (CustomResponder) WriteResponse ¶
func (c CustomResponder) WriteResponse(w http.ResponseWriter, p runtime.Producer)
type ProjectResourceCache ¶
type ProjectResourceCache struct { // Config is the general API server configuration. Config config.Configuration // Context is the API server context. Context context.Context // Notifier is the redis channel subscription via which // a refresh on a given project can be triggered on-demand. Notifier <-chan *redis.Message // IsStopped indicates whether the cache service is stopped. IsStopped bool // contains filtered or unexported fields }
ProjectResourceCache is an in-memory store for caching `projectResource` of all existing projects on the filer.
func (*ProjectResourceCache) Init ¶
func (c *ProjectResourceCache) Init()
init initializes the cache with first reload.
type ResponseError ¶
type ResponseError struct {
// contains filtered or unexported fields
}
ResponseError is an internal error type for the API handler function to determine which response error should be returned to the API client.
func (*ResponseError) Error ¶
func (e *ResponseError) Error() string
type SystemInfoCache ¶
type SystemInfoCache struct { // Config is the general API server configuration. Config config.Configuration // Context is the API server context. Context context.Context // IsStopped indicates whether the cache service is stopped. IsStopped bool // contains filtered or unexported fields }
SystemInfoCache is an in-memory store for caching `systemInfo` of storage systems.
func (*SystemInfoCache) Init ¶
func (c *SystemInfoCache) Init()
init initializes the cache with first reload.
type UserResourceCache ¶
type UserResourceCache struct { // Config is the general API server configuration. Config config.Configuration // Context is the API server context. Context context.Context // Notifier is the redis channel subscription via which // a refresh on a given project can be triggered on-demand. Notifier <-chan *redis.Message // IsStopped indicates whether the cache service is stopped. IsStopped bool // contains filtered or unexported fields }
UserResourceCache is an in-memory store for caching `projectResource` of all existing projects on the filer.
func (*UserResourceCache) Init ¶
func (c *UserResourceCache) Init()
init initializes the cache with first reload.