Class: Manager

olympe.dc. Manager

The Manager acts as a front end to the DataCloud and to the server. It processes transformers and determines if and when new subscriptions must be created or aggregated.


new Manager(logger, dbMgr, queryMgr, transactionMgr, syncMgr, fileService)

Parameters:
Name Type Description
logger olympe.logging.Channel
dbMgr olympe.dc.db.DatabaseManager
queryMgr olympe.dc.query.QueryManager
transactionMgr olympe.dc.transaction.TransactionManager
syncMgr olympe.dc.syncs.SyncManager
fileService olympe.dc.FileServiceManager

Methods


createFile(tag, data, mimeType, onSuccess [, onFailure] [, transaction])

Creates an entry in the file service with the given tag.

Parameters:
Name Type Argument Description
tag string

The tag of the file.

data olympe.df.OString | string | Blob

Initial content for the file.

mimeType string

The MIME type for this file.

onSuccess function

Callback to invoke with the file's path if the creation was successful.

onFailure function <optional>

Callback to invoke with the error code if the creation failed.

transaction olympe.dc.Transaction <optional>

Transaction to update in case of success.

Deprecated:
  • use olympe.dm.File#createFile instead

createSync(tag)

Creates a sync instance from the specified tag.

Parameters:
Name Type Description
tag string

The tag for the new Sync.

Deprecated:
  • use Sync.getInstance instead
Returns:

The created Sync.

Type
olympe.dc.CloudObject

deleteFile(file, onSuccess [, onFailure])

Deletes a File.

Parameters:
Name Type Argument Description
file olympe.dm.File

The file to delete.

onSuccess function

Callback to invoke if the operation is successful.

onFailure function <optional>

Callback to invoke if the operation failed.


deleteSync(tag [, callback])

Delete the sync instance with the specified tag. Once the operation is executed, the provided callback will be called to notify success or failure.

Parameters:
Name Type Argument Description
tag olympe.dc.InstanceTag

The tag of the instance to delete.

callback olympe.dc.Manager.TransactionCallback <optional>

The response callback.

Deprecated:
  • use deleteInstance instead

downloadFile(file, onSuccess [, onFailure])

Downloads the content of a File.

Parameters:
Name Type Argument Description
file olympe.dm.File

The file to download.

onSuccess function

Callback to invoke if the operation is successful.

onFailure function <optional>

Callback to invoke if the operation failed.


executeTransaction(transaction [, callback])

Executes the specified transaction. The provided callback, if present, will be called to notify of success or failure.

Parameters:
Name Type Argument Description
transaction olympe.dc.Transaction

The transaction.

callback olympe.dc.Manager.TransactionCallback <optional>

The transaction callback.

Deprecated:
  • use execute on the transaction itself instead

getSync(tag [, type])

Gets a specific sync.

Parameters:
Name Type Argument Description
tag olympe.df.POString | string

Instance tag.

type function <optional>

Optional sync constructor to cast the returned proxy.

Deprecated:
  • use new olympe.dc.ListDef(tag).getFirst() or Sync.getInstance instead
Returns:

The Sync.

Type
olympe.df.Proxy.<olympe.dc.CloudObject> | olympe.dc.CloudObject

getSyncEntry(tag)

Gets the "resolved" sync entry for the specified tag, that is the tag's entry if available or the first parent entry

Parameters:
Name Type Description
tag string

The tag of the entry.

Returns:

The Sync entry.

Type
olympe.dc.registry.Entry

getSyncs(tagOrConstructor)

Gets all instances of the specified model tag.

Parameters:
Name Type Description
tagOrConstructor olympe.df.POString | string | function

Model tag or sync constructor

Deprecated:
  • use Sync.getInstancesOf instead
Returns:
Type
olympe.dc.ListDef

uploadFile(file, data, onSuccess [, onFailure])

Updates the content of file with new data.

Parameters:
Name Type Argument Description
file olympe.dm.File

The file to update.

data olympe.df.OString | string | Blob

New content for that file.

onSuccess function

Callback to invoke if the operation is successful.

onFailure function <optional>

Callback to invoke if the operation failed.

Type Definitions


TransactionCallback(success, message)

Parameters:
Name Type Argument Description
success boolean
message string <nullable>

TransformationCallback(added, tag, index, deferredRank)

Parameters:
Name Type Description
added boolean

true if the item has been added.

tag string

The tag of the item.

index string

The index, in the list, of the item.

deferredRank olympe.dc.ranking.Deferred