new GroupManagerDb()
GroupManagerDb is a base class for the storage of data used by the
GroupManager. It contains two tables to store Schedules and Members.
This is an abstract base class. A subclass must implement the methods.
For example, see Sqlite3GroupManagerDb (for Nodejs) or IndexedDbGroupManagerDb
(for the browser).
- Source:
Classes
Methods
addMemberPromise(scheduleName, keyName, key, useSync) → {Promise|SyncPromise}
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 SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- 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 | SyncPromise
addSchedulePromise(name, schedule, useSync) → {Promise|SyncPromise}
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 SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- 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 | SyncPromise
deleteMemberPromise(identity, useSync) → {Promise|SyncPromise}
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 SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- 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 | SyncPromise
deleteSchedulePromise(name, useSync) → {Promise|SyncPromise}
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 SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- 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 | SyncPromise
getMemberSchedulePromise(identity, useSync) → {Promise|SyncPromise}
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 SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- 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 | SyncPromise
getScheduleMembersPromise(name, useSync) → {Promise|SyncPromise}
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 SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- 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 | SyncPromise
getSchedulePromise(name, useSync) → {Promise|SyncPromise}
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 SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- 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 | SyncPromise
hasMemberPromise(identity, useSync) → {Promise|SyncPromise}
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 SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- 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 | SyncPromise
hasSchedulePromise(name, useSync) → {Promise|SyncPromise}
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 SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- 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 | SyncPromise
listAllMembersPromise(useSync) → {Promise|SyncPromise}
List all the members.
Parameters:
| Name | Type | Description |
|---|---|---|
useSync |
boolean | (optional) If true then return a SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- 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 | SyncPromise
listAllScheduleNamesPromise(useSync) → {Promise|SyncPromise}
List all the names of the schedules.
Parameters:
| Name | Type | Description |
|---|---|---|
useSync |
boolean | (optional) If true then return a SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- 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 | SyncPromise
renameSchedulePromise(oldName, newName, useSync) → {Promise|SyncPromise}
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 SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- 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 | SyncPromise
updateMemberSchedulePromise(identity, scheduleName, useSync) → {Promise|SyncPromise}
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 SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- 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 | SyncPromise
updateSchedulePromise(name, schedule, useSync) → {Promise|SyncPromise}
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 SyncPromise which is already fulfilled. If omitted or false, this may return a SyncPromise or an async Promise. |
- 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 | SyncPromise