StorageManager
Defined in: packages/synapse-sdk/src/storage/manager.ts:86
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new StorageManager( synapse, warmStorageService, pieceRetriever, withCDN, dev, withIpni?): StorageManager;Defined in: packages/synapse-sdk/src/storage/manager.ts:95
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
synapse | Synapse |
warmStorageService | WarmStorageService |
pieceRetriever | PieceRetriever |
withCDN | boolean |
dev | boolean |
withIpni? | boolean |
Returns
Section titled “Returns”StorageManager
Methods
Section titled “Methods”createContext()
Section titled “createContext()”createContext(options?): Promise<StorageContext>;Defined in: packages/synapse-sdk/src/storage/manager.ts:237
Create a new storage context with specified options
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? | StorageServiceOptions |
Returns
Section titled “Returns”download()
Section titled “download()”download(pieceCid, options?): Promise<Uint8Array<ArrayBufferLike>>;Defined in: packages/synapse-sdk/src/storage/manager.ts:151
Download data from storage If context is provided, routes to context.download() Otherwise performs SP-agnostic download
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
pieceCid | string | PieceLink |
options? | StorageManagerDownloadOptions |
Returns
Section titled “Returns”Promise<Uint8Array<ArrayBufferLike>>
findDataSets()
Section titled “findDataSets()”findDataSets(clientAddress?): Promise<EnhancedDataSetInfo[]>;Defined in: packages/synapse-sdk/src/storage/manager.ts:315
Query data sets for this client
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
clientAddress? | string | Optional client address, defaults to current signer |
Returns
Section titled “Returns”Promise<EnhancedDataSetInfo[]>
Array of enhanced data set information including management status
getDefaultContext()
Section titled “getDefaultContext()”getDefaultContext(): Promise<StorageContext>;Defined in: packages/synapse-sdk/src/storage/manager.ts:306
Get or create the default context
Returns
Section titled “Returns”getStorageInfo()
Section titled “getStorageInfo()”getStorageInfo(): Promise<StorageInfo>;Defined in: packages/synapse-sdk/src/storage/manager.ts:335
Get comprehensive information about the storage service including approved providers, pricing, contract addresses, and current allowances
Returns
Section titled “Returns”Complete storage service information
preflightUpload()
Section titled “preflightUpload()”preflightUpload(size, options?): Promise<PreflightInfo>;Defined in: packages/synapse-sdk/src/storage/manager.ts:212
Run preflight checks for an upload without creating a context
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
size | number | The size of data to upload in bytes |
options? | { metadata?: Record<string, string>; withCDN?: boolean; } | Optional settings including withCDN flag and/or metadata |
options.metadata? | Record<string, string> | - |
options.withCDN? | boolean | - |
Returns
Section titled “Returns”Preflight information including costs and allowances
terminateDataSet()
Section titled “terminateDataSet()”terminateDataSet(dataSetId): Promise<TransactionResponse>;Defined in: packages/synapse-sdk/src/storage/manager.ts:326
Terminate a data set with given ID that belongs to the synapse signer. This will also result in the removal of all pieces in the data set.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
dataSetId | number | The ID of the data set to terminate |
Returns
Section titled “Returns”Transaction response
upload()
Section titled “upload()”upload(data, options?): Promise<UploadResult>;Defined in: packages/synapse-sdk/src/storage/manager.ts:116
Upload data to storage If context is provided, routes to context.upload() Otherwise creates/reuses default context
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
data | | ArrayBuffer | Uint8Array<ArrayBufferLike> |
options? | StorageManagerUploadOptions |