com.github.cloudfiles.localfs

Members list

Type members

Classlikes

class LocalFileSystem(val config: LocalFsConfig) extends ExtensibleFileSystem[Path, LocalFile, LocalFolder, FolderContent[Path, LocalFile, LocalFolder]]

A ''FileSystem'' implementation to manipulate files and folders on a local hard disk.

A ''FileSystem'' implementation to manipulate files and folders on a local hard disk.

This implementation is a bit special, as most of its operations use neither the implicit ''ActorSystem'' nor the actor for sending HTTP requests. (Only the operations that write the content of a file use a stream which depends on the actor system.) Rather, the implementation makes use of Java's ''Path'' and ''Files'' API. These API calls are wrapped in ''Future'' objects that run on the ''ExecutionContext'' defined in the associated LocalFsConfig.

Value parameters

config

the configuration for this file system

Attributes

Supertypes
trait ExtensibleFileSystem[Path, LocalFile, LocalFolder, FolderContent[Path, LocalFile, LocalFolder]]
trait FileSystem[Path, LocalFile, LocalFolder, FolderContent[Path, LocalFile, LocalFolder]]
trait AutoCloseable
class Object
trait Matchable
class Any
Show all
case class LocalFsConfig(basePath: Path, executionContext: ExecutionContext, linkOptions: Seq[LinkOption], sanitizePaths: Boolean)

The configuration class for the local file system implementation.

The configuration class for the local file system implementation.

The most important property is the base path of the local file system. Relative paths are resolved against this root folder. As the ''FileSystem'' API accepts arbitrary paths, it is possible to manipulate elements that are not in the sub tree spawned by the base path. Depending on the context of an application, this may be a security issue. To prevent this, this configuration supports an option to enable a mode in which paths are sanitized; this option is '''true''' per default. In this mode, all paths passed to the file system are normalized, and it is checked whether they are actually sub paths of the base path. If this check fails, the operation fails with an exception.

As the file system implementation typically uses blocking operations, a dedicated ''ExecutionContext'' has to be provided. This is to force the user to think about this option, because simply using the execution context of an already available actor system may not be the best option.

Value parameters

basePath

the base path of the file system; this should be an absolute path

executionContext

the execution context

linkOptions

options for dealing with links

sanitizePaths

flag whether paths should be checked against the base path

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object LocalFsModel

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type