trait FileSystem[ID, FILE, FOLDER, FOLDER_CONTENT] extends AutoCloseable
A trait defining typical operations on files and folders that are stored on a server.
This trait defines the API of a file system. This project provides different implementations supporting different server-based protocols, such as OneDrive or WebDAV.
The protocol defined by this trait is agnostic to the concrete types representing files and folders in the file systems. The single operations are asynchronous; they expect an actor reference of type HttpRequestSender to be passed in and yield a Future with the result. This is indicated by the Operation result type. Operation is a monad, so multiple operations can be composed.
This trait extends AutoClosable to support a mechanism to clean up resources in a safe way. It is, however, expected that most concrete implementations are stateless and thus do not require such a mechanism. Therefore, there is an empty default implementation of the close() method.
- ID
the type representing the ID of a file or folder
- FILE
the type representing a file
- FOLDER
the type representing a folder
- FOLDER_CONTENT
the type representing the content of a folder
- Alphabetic
- By Inheritance
- FileSystem
- AutoCloseable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def createFile(parent: ID, file: File[ID], content: Source[ByteString, Any])(implicit system: ActorSystem[_]): Operation[ID]
Creates a file as a child of the given parent folder by uploading the file's content and setting some metadata attributes.
Creates a file as a child of the given parent folder by uploading the file's content and setting some metadata attributes. The attributes to set are provided in form of a file object; typically some properties are mandatory, such as the file name and the file size. If the operation is successful, the ID of the new file is returned.
- parent
the ID of the parent folder
- file
an object with the attributes of the new file
- content
a Source with the content of the file
- system
the actor system
- returns
the Operation to create a new file
- abstract def createFolder(parent: ID, folder: Folder[ID])(implicit system: ActorSystem[_]): Operation[ID]
Creates a folder as a child of the given parent folder.
Creates a folder as a child of the given parent folder. The attributes of the new folder are defined by the folder object provided. If the operation is successful, the ID of the new folder is returned.
- parent
the ID of the parent folder
- folder
an object with the attributes of the new folder
- system
the actor system
- returns
the Operation to create a new folder
- abstract def deleteFile(fileID: ID)(implicit system: ActorSystem[_]): Operation[Unit]
Deletes the file with the given ID.
Deletes the file with the given ID.
- fileID
the ID of the file to delete
- system
the actor system
- returns
the Operation to delete the file
- abstract def deleteFolder(folderID: ID)(implicit system: ActorSystem[_]): Operation[Unit]
Deletes the folder with the given ID.
Deletes the folder with the given ID. Note that depending on the concrete implementation, it may be required that a folder is empty before it can be deleted. The root folder can typically not be deleted.
- folderID
the ID of the folder to delete
- system
the actor system
- returns
the Operation to delete a folder
- abstract def downloadFile(fileID: ID)(implicit system: ActorSystem[_]): Operation[HttpEntity]
Returns an entity for downloading the content of a file.
Returns an entity for downloading the content of a file. The download can be performed by creating a stream with the data bytes of the resulting entity. Note that the entity must be consumed in all cases, either by running the stream with the data bytes or by discarding the bytes.
- fileID
the ID of the file affected
- system
the actor system
- returns
the Operation to obtain an entity for downloading a file
- abstract def folderContent(id: ID)(implicit system: ActorSystem[_]): Operation[FOLDER_CONTENT]
Returns an object describing the content of the folder with the given ID.
Returns an object describing the content of the folder with the given ID. This can be used to find the files and the folders that are the children of the folder with the ID specified.
- id
the ID of the folder in question
- system
the actor system
- returns
the Operation returning the content of this folder
- abstract def resolveFile(id: ID)(implicit system: ActorSystem[_]): Operation[FILE]
Returns the file identified by the given ID.
Returns the file identified by the given ID.
- id
the ID of the file in question
- system
the actor system
- returns
the Operation returning the file with this ID
- abstract def resolveFolder(id: ID)(implicit system: ActorSystem[_]): Operation[FOLDER]
Returns the folder identified by the given ID.
Returns the folder identified by the given ID.
- id
the ID of the folder in question
- system
the actor system
- returns
the Operation returning the folder with this ID
- abstract def resolvePath(path: String)(implicit system: ActorSystem[_]): Operation[ID]
Resolves the ID of an element (file or folder) that is specified by its path.
Resolves the ID of an element (file or folder) that is specified by its path. This function is analogous to resolvePathComponents(), but the target element of the operation is identified by a URI-like path. It is assumed that the single components in this path are encoded as necessary to yield a valid URI.
- path
the path to be resolved
- system
the actor system
- returns
the Operation to resolve the path
- abstract def rootID(implicit system: ActorSystem[_]): Operation[ID]
Returns the ID of the root folder of this file system.
Returns the ID of the root folder of this file system. This can be used as starting point to iterate over the content stored in the file system.
- system
the actor system
- returns
the Operation returning the ID of the file system root
- abstract def updateFile(file: File[ID])(implicit system: ActorSystem[_]): Operation[Unit]
Updates the metadata of a file.
Updates the metadata of a file. The passed in file object must contain the ID of the file affected and the attributes to set.
- file
the object representing the file
- system
the actor system
- returns
the Operation to update file metadata
- abstract def updateFileContent(fileID: ID, size: Long, content: Source[ByteString, Any])(implicit system: ActorSystem[_]): Operation[Unit]
Updates the content of a file by uploading new data to the server.
Updates the content of a file by uploading new data to the server.
- fileID
the ID of the file affected
- size
the size of the new content
- content
a Source with the content of the file
- system
the actor system
- returns
the Operation to upload new file content
- abstract def updateFolder(folder: Folder[ID])(implicit system: ActorSystem[_]): Operation[Unit]
Updates the metadata of a folder.
Updates the metadata of a folder. The passed in folder object must contain the ID of the folder affected and the attributes to update.
- folder
the object representing the folder
- system
the actor system
- returns
the Operation to update folder metadata
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- def close(): Unit
Frees up resources used by this object when it is no longer needed.
Frees up resources used by this object when it is no longer needed. This base implementation does nothing.
- Definition Classes
- FileSystem → AutoCloseable
- implicit def ec(implicit system: ActorSystem[_]): ExecutionContext
Helper function to obtain an implicit execution context from an implicit actor system.
Helper function to obtain an implicit execution context from an implicit actor system.
- system
the actor system
- returns
the execution context in implicit scope
- Attributes
- protected
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- def resolveFileByPath(path: String)(implicit system: ActorSystem[_]): Operation[FILE]
Returns the file object that is referenced by the path specified.
Returns the file object that is referenced by the path specified. This is a combination of resolving the path and obtaining the file with the resulting ID.
- path
the path of the desired file
- system
the actor system
- returns
the Operation to resolve the file with this path
- def resolveFolderByPath(path: String)(implicit system: ActorSystem[_]): Operation[FOLDER]
Returns the folder object that is referenced by the path specified.
Returns the folder object that is referenced by the path specified. This is a combination of resolving the path and obtaining the folder with the resulting ID.
- path
the path to the desired folder
- system
the actor system
- returns
the Operation to resolve the folder with this path
- def resolvePathComponents(components: Seq[String])(implicit system: ActorSystem[_]): Operation[ID]
Resolves the ID of an element (file or folder) that is specified by a sequence of path components.
Resolves the ID of an element (file or folder) that is specified by a sequence of path components. The components define the names of folders to traverse from the root in order to come to the target element. In a hierarchical file system, there is typically a direct relation between a path and a URI that uniquely identifies an element. But not all file systems are hierarchical; e.g. in Google Drive a single file can be contained in multiple folders, so a resolve operation can be actually complex. The single components passed to this function should be plain file or folder names; no encoding is expected. This implementation encodes the components and concatenates them to a path URI and invokes resolvePath() with this path.
- components
the sequence of path components
- system
the actor system
- returns
the Operation to resolve these path components
- def rootFolderContent(implicit system: ActorSystem[_]): Operation[FOLDER_CONTENT]
Returns an object with the content of the root folder.
Returns an object with the content of the root folder. This is a combination of requesting the root folder ID and requesting the content of this folder.
- system
the actor system
- returns
the Operation to obtain the content of the root folder
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def updateFileAndContent(file: File[ID], content: Source[ByteString, Any])(implicit system: ActorSystem[_]): Operation[Unit]
Combines an operation to update the content of a file with an operation to update its metadata properties.
Combines an operation to update the content of a file with an operation to update its metadata properties. This base implementation delegates to the corresponding functions (updateFileContent() and updateFile()) in series. Implementations that can combine these updates in a single operation should override this function. Depending on the concrete underlying file system, it may be necessary to specify the new file size in the passed in file object.
- file
a data object with the properties of the file to update
- content
a source with the new content of the file
- system
the actor system
- returns
the Operation that does the combined update
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)