FileserverManager#

class controller.services.fileserver.FileserverManager(*, config, fileserver_builder, fileserver_storage, slack_client, logger)#

Bases: object

Manage user file servers.

Unlike with labs, file servers are not normally explicitly shut down. Instead, the file server has an internal idle timeout and exits once that has expired with no activity. A background task watches for exited file servers, deletes the associated resources, and updates the internal state.

This class is a process-wide singleton that manages that background task and the user file server state.

Parameters:

Methods Summary

create(user)

Ensure a file server exists for the given user.

delete(username)

Delete the file server for a user.

list()

List users with running file servers.

start()

Start the background file server tasks.

stop()

Stop background file server tasks.

Methods Documentation

async create(user)#

Ensure a file server exists for the given user.

If the user doesn’t have a fileserver, create it. If the user already has a fileserver, just return. This gets called by the handler when a user comes in through the /files ingress.

Parameters:

user (GafaelfawrUserInfo) – User for which to create a file server.

Raises:
Return type:

None

async delete(username)#

Delete the file server for a user.

Parameters:

username (str) – Username of user.

Raises:

KubernetesError – Raised if there is some failure in a Kubernetes API call.

Return type:

None

async list()#

List users with running file servers.

Return type:

list[str]

async start()#

Start the background file server tasks.

Reconstructs the user state map in the foreground before backgrounding the reconciliation and monitor tasks.

Return type:

None

async stop()#

Stop background file server tasks.

Any started file servers will keep running.

Return type:

None