fusionsc.data

Processing of DataRefs for distributed data (archives, ref publication, ref downloading)

Functions

download(ref)

Retrieves a local copy of the information stored in 'ref'. If possible, transfer of data will be avoided. The retrieved data

openArchive(filename)

Opens the given archive file and provides a DataRef representing its root.

publish(data)

Copies the provided data and provides a DataRef to the in-memory copy.

readArchive(filename)

Opens the given archive file, maps the root node into memory and returns a typed view to the memory-mapped data.

upload(ref)

writeArchive(data, filename)

Writes a copy of 'data' into a local archive file. All transitively contained DataRefs will be downloaded and a copy of them

Functions

fusionsc.data.download(ref: Client) Future

Retrieves a local copy of the information stored in ‘ref’. If possible, transfer of data will be avoided. The retrieved data are immutable and the backing storage is shared across all users in this process. If ‘ref’ was obtained from an archive file, the file contents will be directly mapped into memory

Parameters:

ref: The data ref to download onto

Returns:

The contents of the respective DataRef, interpreted as the appropriate type (either a DataReader if the ref holds raw binary data, or a subtype of CapabilityClient or StructReader typed to the appropriate Cap’n’proto schema).

Note Has asynchronous variant ‘.asnc(…)’ that returns Promise[…]

fusionsc.data.openArchive(filename: str) Client

Opens the given archive file and provides a DataRef representing its root.

Parameters:

filename: File name of the archive file

Returns:

A DataRef pointing to the file root that can be shared or opened using the ‘download’ method.

fusionsc.data.publish(data: Any) Client

Copies the provided data and provides a DataRef to the in-memory copy.

Parameters:

data: The information to store

Returns:

A DataRef pointing to an in-memory copy of ‘data’.

fusionsc.data.readArchive(filename: str) Future

Opens the given archive file, maps the root node into memory and returns a typed view to the memory-mapped data.

Parameters:

filename: File name of the archive file

Returns:

The contents of the archive, interpreted as the appropriate type (either a DataReader if the ref holds raw binary data, or a subtype of CapabilityClient or StructReader typed to the appropriate Cap’n’proto schema).

Note Has asynchronous variant ‘.asnc(…)’ that returns Promise[…]

fusionsc.data.upload(ref: Client) Client
fusionsc.data.writeArchive(data: Any, filename: str) Future

Writes a copy of ‘data’ into a local archive file. All transitively contained DataRefs will be downloaded and a copy of them will be stored in this file. This ensures that an archive always contains a complete copy of all information needed to reconstruct its contents.

Note Has asynchronous variant ‘.asnc(…)’ that returns Promise[…]