Class: Sqlite3GroupManagerDb

Sqlite3GroupManagerDb

new Sqlite3GroupManagerDb(databaseFilePath)

Sqlite3GroupManagerDb extends GroupManagerDb to implement the storage of data used by the GroupManager using the Node.js sqlite3 module. Create a Sqlite3GroupManagerDb to use the given SQLite3 file.
Parameters:
Name Type Description
databaseFilePath string The path of the SQLite file.
Source:
Throws:
GroupManagerDb.Error for a database error.

Methods

addMemberPromise(scheduleName, keyName, key, useSync) → {Promise}

Add a new member with the given key named keyName into a schedule named scheduleName. The member's identity name is keyName.getPrefix(-1).
Parameters:
Name Type Description
scheduleName string The schedule name.
keyName Name The name of the key.
key Blob A Blob of the public key DER.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that fulfills when the member is added, or that is rejected with GroupManagerDb.Error if there's no schedule named scheduleName, if the member's identity name already exists, or other database error.
Type
Promise

addSchedulePromise(name, schedule, useSync) → {Promise}

Add a schedule with the given name.
Parameters:
Name Type Description
name string The name of the schedule. The name cannot be empty.
schedule Schedule The Schedule to add.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that fulfills when the schedule is added, or that is rejected with GroupManagerDb.Error if a schedule with the same name already exists, if the name is empty, or other database error.
Type
Promise

deleteMemberPromise(identity, useSync) → {Promise}

Delete a member with the given identity name. If there is no member with the identity name, then do nothing.
Parameters:
Name Type Description
identity Name The member's identity name.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that fulfills when the member is deleted (or there is no such member), or that is rejected with GroupManagerDb.Error for a database error.
Type
Promise

deleteSchedulePromise(name, useSync) → {Promise}

Delete the schedule with the given name. Also delete members which use this schedule. If there is no schedule with the name, then do nothing.
Parameters:
Name Type Description
name string The name of the schedule.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that fulfills when the schedule is deleted (or there is no such schedule), or that is rejected with GroupManagerDb.Error for a database error.
Type
Promise

eachPromise_()

Call Sqlite3Promise.eachPromise, wrapping an Error in GroupManagerDb.Error.
Source:

getMemberSchedulePromise(identity, useSync) → {Promise}

Get the name of the schedule for the given member's identity name.
Parameters:
Name Type Description
identity Name The member's identity name.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that returns the string schedule name, or that is rejected with GroupManagerDb.Error if there's no member with the given identity name in the database, or other database error.
Type
Promise

getPromise_()

Call Sqlite3Promise.getPromise, wrapping an Error in GroupManagerDb.Error.
Source:

getScheduleIdPromise_(name) → {Promise}

Get the ID for the schedule.
Parameters:
Name Type Description
name string The schedule name.
Source:
Returns:
A promise that returns the ID (or -1 if not found), or that is rejected with GroupManagerDb.Error for a database error.
Type
Promise

getScheduleMembersPromise(name, useSync) → {Promise}

For each member using the given schedule, get the name and public key DER of the member's key.
Parameters:
Name Type Description
name string The name of the schedule.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that returns a new array of object (where "keyName" is the Name of the public key and "publicKey" is the Blob of the public key DER), or that is rejected with GroupManagerDb.Error for a database error. Note that the member's identity name is keyName.getPrefix(-1). If the schedule name is not found, the list is empty.
Type
Promise

getSchedulePromise(name, useSync) → {Promise}

Get a schedule with the given name.
Parameters:
Name Type Description
name string The name of the schedule.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that returns a new Schedule object, or that is rejected with GroupManagerDb.Error if the schedule does not exist or other database error.
Type
Promise

hasMemberPromise(identity, useSync) → {Promise}

Check if there is a member with the given identity name.
Parameters:
Name Type Description
identity Name The member's identity name.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that returns true if there is a member (else false), or that is rejected with GroupManagerDb.Error for a database error.
Type
Promise

hasSchedulePromise(name, useSync) → {Promise}

Check if there is a schedule with the given name.
Parameters:
Name Type Description
name string The name of the schedule.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that returns true if there is a schedule (else false), or that is rejected with GroupManagerDb.Error for a database error.
Type
Promise

listAllMembersPromise(useSync) → {Promise}

List all the members.
Parameters:
Name Type Description
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that returns a new array of Name with the names of all members, or that is rejected with GroupManagerDb.Error for a database error.
Type
Promise

listAllScheduleNamesPromise(useSync) → {Promise}

List all the names of the schedules.
Parameters:
Name Type Description
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that returns a new array of string with the names of all schedules, or that is rejected with GroupManagerDb.Error for a database error.
Type
Promise

renameSchedulePromise(oldName, newName, useSync) → {Promise}

Rename a schedule with oldName to newName.
Parameters:
Name Type Description
oldName string The name of the schedule to be renamed.
newName string The new name of the schedule. The name cannot be empty.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that fulfills when the schedule is renamed, or that is rejected with GroupManagerDb.Error if a schedule with newName already exists, if the schedule with oldName does not exist, if newName is empty, or other database error.
Type
Promise

runPromise_()

Call Sqlite3Promise.runPromise, wrapping an Error in GroupManagerDb.Error.
Source:

updateMemberSchedulePromise(identity, scheduleName, useSync) → {Promise}

Change the name of the schedule for the given member's identity name.
Parameters:
Name Type Description
identity Name The member's identity name.
scheduleName string The new schedule name.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that fulfills when the member is updated, or that is rejected with GroupManagerDb.Error if there's no member with the given identity name in the database, or there's no schedule named scheduleName, or other database error.
Type
Promise

updateSchedulePromise(name, schedule, useSync) → {Promise}

Update the schedule with name and replace the old object with the given schedule. Otherwise, if no schedule with name exists, a new schedule with name and the given schedule will be added to database.
Parameters:
Name Type Description
name string The name of the schedule. The name cannot be empty.
schedule Schedule The Schedule to update or add.
useSync boolean (optional) If true then return a rejected promise since this only supports async code.
Source:
Returns:
A promise that fulfills when the schedule is updated, or that is rejected with GroupManagerDb.Error if the name is empty, or other database error.
Type
Promise