CachePathComponentsResolver

com.github.cloudfiles.crypt.fs.resolver.CachePathComponentsResolver

A module providing a PathResolver implementation that caches the paths it has already resolved.

This resolver implementation is appropriate if there are many operations to resolve paths and if the algorithm in used yields different results for each encrypt operation. Internally, it makes use of an actor that manages an LRU cache of a configured size. When asked to resolve a specific path, it iterates over the single path components. The components that have already been resolved can be looked up directly from the cache. For the remaining components, the content of the single folders are loaded, and all element names are decrypted and added to the cache. So, provided that the cache has a sufficient size, later resolve operations for elements in the same folder structure can be served efficiently.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

sealed trait PathLookupCommand[ID, FILE <: File[ID], FOLDER <: Folder[ID]]

The base type of messages processed by the actor that manages the cache of already resolved paths.

The base type of messages processed by the actor that manages the cache of already resolved paths.

Type parameters

FILE

the type of files

FOLDER

the type of folders

ID

the ID type

Attributes

Supertypes
class Object
trait Matchable
class Any

Value members

Concrete methods

def apply[ID, FILE <: File[ID], FOLDER <: Folder[ID]](spawner: Spawner, cacheSize: Int, decryptChunkSize: Int, optActorName: Option[String])(implicit timeout: Timeout): PathResolver[ID, FILE, FOLDER]

Creates a new instance of ''CachePathComponentsResolver'' with the given parameters. This function creates an actor to resolve paths and manage the cache with already resolved paths via the spawner provided. It is also possible to configure a chunk size for decrypt operations. If the chunk size is negative (which is the default), the names of all elements in a folder are decrypted at once, and then this result is processed further. For chunk sizes greater than 0, results are already processed when this number of names has been decrypted; this allows for some more parallelism, and a request may be answered earlier when the required piece of information becomes available.

Creates a new instance of ''CachePathComponentsResolver'' with the given parameters. This function creates an actor to resolve paths and manage the cache with already resolved paths via the spawner provided. It is also possible to configure a chunk size for decrypt operations. If the chunk size is negative (which is the default), the names of all elements in a folder are decrypted at once, and then this result is processed further. For chunk sizes greater than 0, results are already processed when this number of names has been decrypted; this allows for some more parallelism, and a request may be answered earlier when the required piece of information becomes available.

Type parameters

FILE

the type of files

FOLDER

the type of folders

ID

the ID type

Value parameters

cacheSize

the size of the cache

decryptChunkSize

the chunk size for decrypt operations

optActorName

the optional actor name

spawner

the ''Spawner'' to create the resolver actor

Attributes

Returns

the new resolver instance

def apply[ID, FILE <: File[ID], FOLDER <: Folder[ID]](resolverActor: ActorRef[PathLookupCommand[ID, FILE, FOLDER]])(implicit timeout: Timeout): PathResolver[ID, FILE, FOLDER]

Creates a new instance of ''CachePathComponentsResolver'' that uses the given resolver actor to handle resolve requests.

Creates a new instance of ''CachePathComponentsResolver'' that uses the given resolver actor to handle resolve requests.

Type parameters

FILE

the type of files

FOLDER

the type of folders

ID

the ID type

Value parameters

resolverActor

the actor that does the resolving

Attributes

Returns

the new resolver instance

def pathResolverActor[ID, FILE <: File[ID], FOLDER <: Folder[ID]](cacheSize: Int, decryptChunkSize: Int): Behavior[PathLookupCommand[ID, FILE, FOLDER]]

Returns the behavior of a resolver actor that manages a cache with resolved paths of the given size.

Returns the behavior of a resolver actor that manages a cache with resolved paths of the given size.

Type parameters

FILE

the type of files

FOLDER

the type of folders

ID

the ID type

Value parameters

cacheSize

the cache size

decryptChunkSize

the chunk size for decrypt operations

Attributes

Returns

the behavior of the resolver actor

def stopPathResolverActor[ID, FILE <: File[ID], FOLDER <: Folder[ID]](actor: ActorRef[PathLookupCommand[ID, FILE, FOLDER]]): Unit

Stops the given path resolver actor. This function is normally not called by an application, as the resolver actor is stopped automatically by the resolver when its ''close()'' function is called.

Stops the given path resolver actor. This function is normally not called by an application, as the resolver actor is stopped automatically by the resolver when its ''close()'' function is called.

Type parameters

FILE

the type of files

FOLDER

the type of folders

ID

the ID type

Value parameters

actor

the actor to be stopped

Attributes

Concrete fields

final val DefaultResolveTimeout: Timeout

The default timeout for resolve operations.

The default timeout for resolve operations.

Attributes