RamDiskInterface Class Reference

#include <ramdisk.h>

Inheritance diagram for RamDiskInterface:

Detailed Description

A RamDisk provides a complete in-memory file system. It supports a Clone method to efficiently duplicate a whole file system.

Public Types

using PermissionChecker = Delegate< Result< void >(const Url &url)>
 

Public Member Functions

MAXON_METHOD Result< UrlGetRoot ()
 
MAXON_METHOD Result< FileUtilities::ReadDirectoryTreeReceiverMount (const Block< const String > &mountPoint, const Url &source, const Url &mirror)
 
MAXON_METHOD Result< void > SetPermissions (PermissionChecker &&permissions)
 
 MAXON_OBSERVABLE (void, ObservableLoadIntoCacheChange,(const RamDiskRef &ramDisk, Bool finished), ObservableCombinerRunAllComponent)
 
MAXON_METHOD Result< void > ChangeMirrowPath (const Url &oldBase, const Url &newBase)
 

Static Public Member Functions

static MAXON_METHOD Result< Tuple< Bool, Url > > IsInCache (const Url &url)
 
static MAXON_METHOD Result< void > LoadIntoCache (const Url &url, const IoProgressDelegate &progress)
 
static MAXON_METHOD Result< void > RemoveFromCache (const Url &url)
 
static MAXON_METHOD Result< RamDiskRef > Create ()
 
static MAXON_METHOD Result< void > ChangeRamDiskMirrowPath (const Url &oldBase, const Url &newBase)
 

Private Member Functions

 MAXON_INTERFACE (RamDiskInterface, MAXON_REFERENCE_NORMAL, "net.maxon.misc.interface.ramdisk")
 

Member Typedef Documentation

◆ PermissionChecker

using PermissionChecker = Delegate<Result<void>(const Url& url)>

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( RamDiskInterface  ,
MAXON_REFERENCE_NORMAL  ,
"net.maxon.misc.interface.ramdisk"   
)
private

◆ GetRoot()

MAXON_METHOD Result<Url> GetRoot ( )

Returns the Url of the root directory of this RAM disk. The Url has the ramdisk scheme and uses the unique identifier of the RAM disk as authority. Also the returned Url contains a strong reference on this RAM disk, so it suffices to keep the Url alive to keep this RAM disk alive. Likewise all Urls which are derived from the returned Url will contain a strong reference.

Returns
The Url of this RAM disk's root directory.

◆ Mount()

MAXON_METHOD Result<FileUtilities::ReadDirectoryTreeReceiver> Mount ( const Block< const String > &  mountPoint,
const Url source,
const Url mirror 
)

◆ SetPermissions()

MAXON_METHOD Result<void> SetPermissions ( PermissionChecker &&  permissions)

Sets the permission checker for this RAM disk.

Parameters
[in]permissionsDelegate which gets called to check for valid permissions whenever a stream is opened.

◆ MAXON_OBSERVABLE()

MAXON_OBSERVABLE ( void  ,
ObservableLoadIntoCacheChange  ,
(const RamDiskRef &ramDisk, Bool finished)  ,
ObservableCombinerRunAllComponent   
)

◆ IsInCache()

static MAXON_METHOD Result<Tuple<Bool, Url> > IsInCache ( const Url url)
static

IsInCache allows to detect if the url is cached.

Parameters
[in]urlUrl to detect.
Returns
returns the url of the cache if the file cached. If empty no cache exists.

◆ LoadIntoCache()

static MAXON_METHOD Result<void> LoadIntoCache ( const Url url,
const IoProgressDelegate progress 
)
static

◆ RemoveFromCache()

static MAXON_METHOD Result<void> RemoveFromCache ( const Url url)
static

◆ Create()

static MAXON_METHOD Result<RamDiskRef> Create ( )
static

◆ ChangeMirrowPath()

MAXON_METHOD Result<void> ChangeMirrowPath ( const Url oldBase,
const Url newBase 
)

◆ ChangeRamDiskMirrowPath()

static MAXON_METHOD Result<void> ChangeRamDiskMirrowPath ( const Url oldBase,
const Url newBase 
)
static