API • Docs
API / <internal> / CoreManager
TypedEmitter
new CoreManager(
options
):CoreManager
• options
• options.autoDownload: undefined
| boolean
= true
Immediately start downloading cores - should only be set to false for tests
• options.db: BetterSQLite3Database
<Record
<string
, never
>>
Drizzle better-sqlite3 database instance
• options.encryptionKeys: undefined
| Partial
<Record
<"blob"
| "auth"
| "config"
| "data"
| "blobIndex"
, Buffer
>> = {}
Encryption keys for each namespace
• options.keyManager: KeyManager
mapeo/crypto KeyManager instance
• options.logger: undefined
| Logger
• options.projectKey: Buffer
32-byte public key of the project creator core
• options.projectSecretKey: undefined
| Buffer
32-byte secret key of the project creator core
• options.storage: HypercoreStorage
Folder to store all hypercore data
TypedEmitter.constructor
get
creatorCore():Core
get
creatorCoreRecord():CoreRecord
get
deviceId():string
string
get
static
namespaces(): readonly ["auth"
,"config"
,"data"
,"blobIndex"
,"blob"
]
readonly ["auth"
, "config"
, "data"
, "blobIndex"
, "blob"
]
[kCoreManagerReplicate](
stream
):ReplicationStream
ONLY FOR TESTING Replicate all cores in core manager
NB: Remote peers need to be manually added when unit testing core manager without the Sync API
• stream: any
ReplicationStream
addCore(
key
,namespace
):CoreRecord
Add a core to the manager (will be persisted across restarts)
• key: Buffer
32-byte public key of core to add
• namespace: "blob"
| "auth"
| "config"
| "data"
| "blobIndex"
close():
Promise
<void
>
Close all open cores and end any replication streams TODO: gracefully close replication streams
Promise
<void
>
deleteOthersData(
namespace
):Promise
<void
>
• namespace: "blob"
| "config"
| "data"
| "blobIndex"
Promise
<void
>
getCoreByDiscoveryKey(
discoveryKey
):undefined
|CoreRecord
Get a core by its discovery key
• discoveryKey: Buffer
undefined
| CoreRecord
getCoreByKey(
key
):undefined
|Core
Get a core by its public key
• key: Buffer
undefined
| Core
getCores(
namespace
):CoreRecord
[]
Get an array of all cores in the given namespace
• namespace: "blob"
| "auth"
| "config"
| "data"
| "blobIndex"
getWriterCore(
namespace
):CoreRecord
Get the writer core for the given namespace
• namespace: "blob"
| "auth"
| "config"
| "data"
| "blobIndex"
ready():
Promise
<void
>
Resolves when all cores have finished loading
Promise
<void
>
sendDownloadIntents(
blobFilter
,peer
):void
• blobFilter: BlobFilter
• peer: HypercorePeer
void