@oceanprotocol/lib 9.1.1 → 9.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib.modern.mjs +2 -2
- package/dist/lib.module.mjs +2 -2
- package/dist/types/@types/Provider.d.ts +103 -0
- package/dist/types/services/providers/BaseProvider.d.ts +31 -1
- package/dist/types/services/providers/HttpProvider.d.ts +28 -1
- package/dist/types/services/providers/P2pProvider.d.ts +54 -1
- package/package.json +1 -1
|
@@ -83,6 +83,106 @@ export interface NodeStatus {
|
|
|
83
83
|
accessLists?: AccessList[];
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Shapes for the per-node resource metrics API (`getNodeMetrics` /
|
|
88
|
+
* `getNodeMetricsHistory`). These mirror the `@types/nodeMetrics.ts` types on the ocean-node
|
|
89
|
+
* side, so the client payload and the node response have an identical shape.
|
|
90
|
+
*/
|
|
91
|
+
export interface NodeMetricsGpu {
|
|
92
|
+
resourceId: string;
|
|
93
|
+
vendor?: string;
|
|
94
|
+
utilizationPercent?: number;
|
|
95
|
+
memoryUsedBytes?: number;
|
|
96
|
+
memoryTotalBytes?: number;
|
|
97
|
+
temperatureC?: number;
|
|
98
|
+
powerWatts?: number;
|
|
99
|
+
}
|
|
100
|
+
export interface NodeMetricsEnvResource {
|
|
101
|
+
env: string;
|
|
102
|
+
resource: string;
|
|
103
|
+
total: number;
|
|
104
|
+
inUse: number;
|
|
105
|
+
}
|
|
106
|
+
export interface NodeMetricsSnapshot {
|
|
107
|
+
collectedAt: number;
|
|
108
|
+
hasAggregate: boolean;
|
|
109
|
+
cpu: {
|
|
110
|
+
usagePercent: number;
|
|
111
|
+
coresAllocated: number;
|
|
112
|
+
hostCores: number;
|
|
113
|
+
throttledCount: number;
|
|
114
|
+
loadAverage: number[];
|
|
115
|
+
};
|
|
116
|
+
memory: {
|
|
117
|
+
usedBytes: number;
|
|
118
|
+
limitBytes: number;
|
|
119
|
+
hostFreeBytes: number;
|
|
120
|
+
hostTotalBytes: number;
|
|
121
|
+
};
|
|
122
|
+
disk: {
|
|
123
|
+
usedBytes: number;
|
|
124
|
+
};
|
|
125
|
+
network: {
|
|
126
|
+
rxBytes: number;
|
|
127
|
+
txBytes: number;
|
|
128
|
+
};
|
|
129
|
+
jobs: {
|
|
130
|
+
running: number;
|
|
131
|
+
runningFree: number;
|
|
132
|
+
queued: number;
|
|
133
|
+
queuedFree: number;
|
|
134
|
+
};
|
|
135
|
+
gpu: NodeMetricsGpu[];
|
|
136
|
+
env: NodeMetricsEnvResource[];
|
|
137
|
+
meta: {
|
|
138
|
+
sampledContainers: number;
|
|
139
|
+
oldestSampleAgeSeconds: number;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* One hourly bucket returned by `getNodeMetricsHistory`. Scalars are arithmetic means over the
|
|
144
|
+
* hour's samples; `sampleCount` is how many minute-samples fed the average.
|
|
145
|
+
*/
|
|
146
|
+
export interface NodeMetricsHourly {
|
|
147
|
+
hourStart: number;
|
|
148
|
+
sampleCount: number;
|
|
149
|
+
cpu: {
|
|
150
|
+
usagePercent: number;
|
|
151
|
+
coresAllocated: number;
|
|
152
|
+
hostCores: number;
|
|
153
|
+
throttledCount: number;
|
|
154
|
+
};
|
|
155
|
+
memory: {
|
|
156
|
+
usedBytes: number;
|
|
157
|
+
limitBytes: number;
|
|
158
|
+
hostFreeBytes: number;
|
|
159
|
+
hostTotalBytes: number;
|
|
160
|
+
};
|
|
161
|
+
disk: {
|
|
162
|
+
usedBytes: number;
|
|
163
|
+
};
|
|
164
|
+
network: {
|
|
165
|
+
rxBytes: number;
|
|
166
|
+
txBytes: number;
|
|
167
|
+
};
|
|
168
|
+
jobs: {
|
|
169
|
+
running: number;
|
|
170
|
+
runningFree: number;
|
|
171
|
+
queued: number;
|
|
172
|
+
queuedFree: number;
|
|
173
|
+
};
|
|
174
|
+
gpu: NodeMetricsGpu[];
|
|
175
|
+
env: NodeMetricsEnvResource[];
|
|
176
|
+
meta: {
|
|
177
|
+
sampledContainers: number;
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
export interface NodeMetricsHistoryResult {
|
|
181
|
+
startTime: number;
|
|
182
|
+
stopTime: number;
|
|
183
|
+
count: number;
|
|
184
|
+
buckets: NodeMetricsHourly[];
|
|
185
|
+
}
|
|
86
186
|
export interface UserCustomParameters {
|
|
87
187
|
[key: string]: any;
|
|
88
188
|
}
|
|
@@ -118,6 +218,8 @@ export declare const PROTOCOL_COMMANDS: {
|
|
|
118
218
|
GET_P2P_PEER: string;
|
|
119
219
|
GET_P2P_PEERS: string;
|
|
120
220
|
GET_P2P_NETWORK_STATS: string;
|
|
221
|
+
GET_NODE_METRICS: string;
|
|
222
|
+
GET_NODE_METRICS_HISTORY: string;
|
|
121
223
|
FIND_PEER: string;
|
|
122
224
|
CREATE_AUTH_TOKEN: string;
|
|
123
225
|
INVALIDATE_AUTH_TOKEN: string;
|
|
@@ -132,6 +234,7 @@ export declare const PROTOCOL_COMMANDS: {
|
|
|
132
234
|
PERSISTENT_STORAGE_UPLOAD_FILE: string;
|
|
133
235
|
PERSISTENT_STORAGE_GET_FILE_OBJECT: string;
|
|
134
236
|
PERSISTENT_STORAGE_DELETE_FILE: string;
|
|
237
|
+
PERSISTENT_STORAGE_DOWNLOAD_FILE: string;
|
|
135
238
|
SERVICE_GET_TEMPLATES: string;
|
|
136
239
|
SERVICE_START: string;
|
|
137
240
|
SERVICE_STOP: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Signer } from 'ethers';
|
|
2
|
-
import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ComputeResultStream, FindComputeProvidersRequest, FindComputeProvidersResult, ProviderInitialize, ProviderComputeInitializeResults, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, DownloadResponse, NodeStatus, NodeComputeJob, NodeLogEntry, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceJobListed, ServiceListFilters, ServiceRestartParams, ServiceTemplatePublic, ServiceStartParams, ServicePayment, OceanNode, CompleteSignature, SignerOrAuthTokenOrSignature } from '../../@types/index.js';
|
|
2
|
+
import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ComputeResultStream, FindComputeProvidersRequest, FindComputeProvidersResult, ProviderInitialize, ProviderComputeInitializeResults, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, DownloadResponse, NodeStatus, NodeComputeJob, NodeMetricsSnapshot, NodeMetricsHistoryResult, NodeLogEntry, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceJobListed, ServiceListFilters, ServiceRestartParams, ServiceTemplatePublic, ServiceStartParams, ServicePayment, OceanNode, CompleteSignature, SignerOrAuthTokenOrSignature } from '../../@types/index.js';
|
|
3
3
|
import { type DDO, type ValidateMetadata } from '@oceanprotocol/ddo-js';
|
|
4
4
|
import { type P2pProvider, type P2PConfig, type P2PRequestBodyStream } from './P2pProvider.js';
|
|
5
5
|
export { OCEAN_P2P_PROTOCOL, type P2PConfig, type P2pProviderRecord, type Multiaddr, P2pError, type P2pErrorType, classifyP2pError, isRetryableP2pError } from './P2pProvider.js';
|
|
@@ -126,6 +126,24 @@ export declare class BaseProvider {
|
|
|
126
126
|
downloadNodeLogs(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, startTime: string, endTime: string, maxLogs?: number, moduleName?: string, level?: string, page?: number, signal?: AbortSignal): Promise<NodeLogEntry[]>;
|
|
127
127
|
getNodeStatus(nodeUri: OceanNode, signal?: AbortSignal): Promise<NodeStatus>;
|
|
128
128
|
getNodeJobs(nodeUri: OceanNode, fromTimestamp?: number, signal?: AbortSignal): Promise<NodeComputeJob[]>;
|
|
129
|
+
/**
|
|
130
|
+
* Returns the live per-node resource metrics snapshot. Routes to HTTP (`GET /nodeMetrics`)
|
|
131
|
+
* or P2P (GET_NODE_METRICS command) depending on the node target.
|
|
132
|
+
* @param {OceanNode} nodeUri - node HTTP endpoint, peerId or multiaddr
|
|
133
|
+
* @param {AbortSignal} [signal] - optional abort signal to cancel the request
|
|
134
|
+
* @return {Promise<NodeMetricsSnapshot | null>} the snapshot, or null if unavailable
|
|
135
|
+
*/
|
|
136
|
+
getNodeMetrics(nodeUri: OceanNode, signal?: AbortSignal): Promise<NodeMetricsSnapshot | null>;
|
|
137
|
+
/**
|
|
138
|
+
* Returns the hourly per-node resource history. Bounds are optional (epoch ms or ISO-8601).
|
|
139
|
+
* Routes to HTTP (`GET /nodeMetrics/history`) or P2P (GET_NODE_METRICS_HISTORY command).
|
|
140
|
+
* @param {OceanNode} nodeUri - node HTTP endpoint, peerId or multiaddr
|
|
141
|
+
* @param {number | string} [startTime] - optional range start (epoch ms or ISO-8601)
|
|
142
|
+
* @param {number | string} [stopTime] - optional range end (epoch ms or ISO-8601)
|
|
143
|
+
* @param {AbortSignal} [signal] - optional abort signal to cancel the request
|
|
144
|
+
* @return {Promise<NodeMetricsHistoryResult | null>} the history, or null if unavailable
|
|
145
|
+
*/
|
|
146
|
+
getNodeMetricsHistory(nodeUri: OceanNode, startTime?: number | string, stopTime?: number | string, signal?: AbortSignal): Promise<NodeMetricsHistoryResult | null>;
|
|
129
147
|
setupP2P(config: P2PConfig): Promise<void>;
|
|
130
148
|
getLibp2pNode(): import("libp2p").Libp2p<import("@libp2p/interface").ServiceMap>;
|
|
131
149
|
/**
|
|
@@ -185,6 +203,18 @@ export declare class BaseProvider {
|
|
|
185
203
|
getPersistentStorageFileObject(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, signal?: AbortSignal): Promise<PersistentStorageObject>;
|
|
186
204
|
uploadPersistentStorageFile(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, content: P2PRequestBodyStream, signal?: AbortSignal): Promise<PersistentStorageFileEntry>;
|
|
187
205
|
deletePersistentStorageFile(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, signal?: AbortSignal): Promise<PersistentStorageDeleteFileResponse>;
|
|
206
|
+
/**
|
|
207
|
+
* Downloads a file stored in a persistent-storage bucket, dispatching to the HTTP
|
|
208
|
+
* or P2P transport based on `nodeUri`.
|
|
209
|
+
* @param {OceanNode} nodeUri The provider target (HTTP URL, or peerId / multiaddr for P2P).
|
|
210
|
+
* @param {SignerOrAuthTokenOrSignature} signerOrAuthToken Signer, JWT auth token, or precomputed signature used to authenticate the request.
|
|
211
|
+
* @param {string} bucketId The bucket holding the file.
|
|
212
|
+
* @param {string} fileName The name of the file to download.
|
|
213
|
+
* @param {number} [offset=0] Byte offset to resume the download from. Must be a non-negative safe integer. Over HTTP this becomes a `Range` request (server must answer 206 starting at `offset`); over P2P it is sent in the request payload.
|
|
214
|
+
* @param {AbortSignal} [signal] Abort signal that cancels the download.
|
|
215
|
+
* @return {Promise<ComputeResultStream>} An async-iterable stream of the file body starting at `offset`.
|
|
216
|
+
*/
|
|
217
|
+
downloadPersistentStorageFile(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, offset?: number, signal?: AbortSignal): Promise<ComputeResultStream>;
|
|
188
218
|
getServiceTemplates(nodeUri: OceanNode, chainId?: number, signal?: AbortSignal): Promise<ServiceTemplatePublic[]>;
|
|
189
219
|
serviceStart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, params: ServiceStartParams, signal?: AbortSignal): Promise<ServiceJob[]>;
|
|
190
220
|
serviceStop(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, signal?: AbortSignal): Promise<ServiceJob[]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Signer } from 'ethers';
|
|
2
|
-
import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, ComputeResultStream, NodeStatus, NodeComputeJob, NodeLogEntry, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceJobListed, ServiceListFilters, ServiceRestartParams, ServiceTemplatePublic, ServiceStartParams, ServicePayment, SignerOrAuthTokenOrSignature } from '../../@types/index.js';
|
|
2
|
+
import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, ComputeResultStream, NodeStatus, NodeComputeJob, NodeLogEntry, NodeMetricsSnapshot, NodeMetricsHistoryResult, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceJobListed, ServiceListFilters, ServiceRestartParams, ServiceTemplatePublic, ServiceStartParams, ServicePayment, SignerOrAuthTokenOrSignature } from '../../@types/index.js';
|
|
3
3
|
import { type DDO, type ValidateMetadata } from '@oceanprotocol/ddo-js';
|
|
4
4
|
import { type P2PRequestBodyStream } from './P2pProvider.js';
|
|
5
5
|
export declare class HttpProvider {
|
|
@@ -14,6 +14,22 @@ export declare class HttpProvider {
|
|
|
14
14
|
private getNodeInfo;
|
|
15
15
|
getNodeStatus(nodeUri: string, signal?: AbortSignal): Promise<NodeStatus>;
|
|
16
16
|
getNodeJobs(nodeUri: string, fromTimestamp?: number, signal?: AbortSignal): Promise<NodeComputeJob[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Returns the live per-node resource metrics snapshot via `GET /nodeMetrics`.
|
|
19
|
+
* @param {string} nodeUri - node HTTP endpoint
|
|
20
|
+
* @param {AbortSignal} [signal] - optional abort signal to cancel the request
|
|
21
|
+
* @return {Promise<NodeMetricsSnapshot | null>} the snapshot, or null if unavailable
|
|
22
|
+
*/
|
|
23
|
+
getNodeMetrics(nodeUri: string, signal?: AbortSignal): Promise<NodeMetricsSnapshot | null>;
|
|
24
|
+
/**
|
|
25
|
+
* Returns the hourly per-node resource history via `GET /nodeMetrics/history`.
|
|
26
|
+
* @param {string} nodeUri - node HTTP endpoint
|
|
27
|
+
* @param {number | string} startTime - optional range start (epoch ms or ISO-8601)
|
|
28
|
+
* @param {number | string} stopTime - optional range end (epoch ms or ISO-8601)
|
|
29
|
+
* @param {AbortSignal} [signal] - optional abort signal to cancel the request
|
|
30
|
+
* @return {Promise<NodeMetricsHistoryResult | null>} the history, or null if unavailable
|
|
31
|
+
*/
|
|
32
|
+
getNodeMetricsHistory(nodeUri: string, startTime?: number | string, stopTime?: number | string, signal?: AbortSignal): Promise<NodeMetricsHistoryResult | null>;
|
|
17
33
|
/**
|
|
18
34
|
* Returns the node public key
|
|
19
35
|
* @return {string} The node public key
|
|
@@ -272,6 +288,17 @@ export declare class HttpProvider {
|
|
|
272
288
|
getPersistentStorageBuckets(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, owner: string, signal?: AbortSignal): Promise<PersistentStorageBucket[]>;
|
|
273
289
|
listPersistentStorageFiles(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, signal?: AbortSignal): Promise<PersistentStorageFileEntry[]>;
|
|
274
290
|
getPersistentStorageFileObject(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, signal?: AbortSignal): Promise<PersistentStorageObject>;
|
|
291
|
+
/**
|
|
292
|
+
* Downloads a file stored in a persistent-storage bucket over HTTP.
|
|
293
|
+
* @param {string} nodeUri The provider URI.
|
|
294
|
+
* @param {SignerOrAuthTokenOrSignature} signerOrAuthToken Signer, JWT auth token, or precomputed signature used to authenticate the request.
|
|
295
|
+
* @param {string} bucketId The bucket holding the file.
|
|
296
|
+
* @param {string} fileName The name of the file to download.
|
|
297
|
+
* @param {number} [offset=0] Byte offset to resume the download from. When greater than 0 a `Range: bytes=<offset>-` header is sent and the server must answer with `206 Partial Content` starting at that offset. Must be a non-negative safe integer.
|
|
298
|
+
* @param {AbortSignal} [signal] Abort signal that cancels the in-flight request.
|
|
299
|
+
* @return {Promise<ComputeResultStream>} An async-iterable stream of the file body starting at `offset`.
|
|
300
|
+
*/
|
|
301
|
+
downloadPersistentStorageFile(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, offset?: number, signal?: AbortSignal): Promise<ComputeResultStream>;
|
|
275
302
|
uploadPersistentStorageFile(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, content: P2PRequestBodyStream, signal?: AbortSignal): Promise<PersistentStorageFileEntry>;
|
|
276
303
|
deletePersistentStorageFile(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, signal?: AbortSignal): Promise<PersistentStorageDeleteFileResponse>;
|
|
277
304
|
updatePersistentStorageBucket(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, label: string | null, signal?: AbortSignal): Promise<PersistentStorageUpdateBucketResponse>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Libp2p, type Libp2pOptions } from 'libp2p';
|
|
2
2
|
import { type Multiaddr } from '@multiformats/multiaddr';
|
|
3
3
|
import { Signer } from 'ethers';
|
|
4
|
-
import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, DownloadResponse, ComputeResultStream, NodeStatus, NodeComputeJob, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceJobListed, ServiceListFilters, ServiceRestartParams, ServiceTemplatePublic, ServiceStartParams, ServicePayment, OceanNode, SignerOrAuthTokenOrSignature } from '../../@types/index.js';
|
|
4
|
+
import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, DownloadResponse, ComputeResultStream, NodeStatus, NodeComputeJob, NodeMetricsSnapshot, NodeMetricsHistoryResult, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceJobListed, ServiceListFilters, ServiceRestartParams, ServiceTemplatePublic, ServiceStartParams, ServicePayment, OceanNode, SignerOrAuthTokenOrSignature } from '../../@types/index.js';
|
|
5
5
|
import { NodeLogEntry } from '../../@types/Provider.js';
|
|
6
6
|
import { type DDO, type ValidateMetadata } from '@oceanprotocol/ddo-js';
|
|
7
7
|
import { CID } from 'multiformats/cid';
|
|
@@ -502,6 +502,22 @@ export declare class P2pProvider {
|
|
|
502
502
|
*/
|
|
503
503
|
getNodeStatus(nodeUri: OceanNode, signal?: AbortSignal): Promise<NodeStatus>;
|
|
504
504
|
getNodeJobs(nodeUri: OceanNode, fromTimestamp?: number, signal?: AbortSignal): Promise<NodeComputeJob[]>;
|
|
505
|
+
/**
|
|
506
|
+
* Returns the live per-node resource metrics snapshot via the P2P GET_NODE_METRICS command.
|
|
507
|
+
* @param {OceanNode} nodeUri - peerId/multiaddr of the node
|
|
508
|
+
* @param {AbortSignal} [signal] - optional abort signal to cancel the request
|
|
509
|
+
* @return {Promise<NodeMetricsSnapshot | null>} the snapshot, or null if unavailable
|
|
510
|
+
*/
|
|
511
|
+
getNodeMetrics(nodeUri: OceanNode, signal?: AbortSignal): Promise<NodeMetricsSnapshot | null>;
|
|
512
|
+
/**
|
|
513
|
+
* Returns the hourly per-node resource history via the P2P GET_NODE_METRICS_HISTORY command.
|
|
514
|
+
* @param {OceanNode} nodeUri - peerId/multiaddr of the node
|
|
515
|
+
* @param {number | string} startTime - optional range start (epoch ms or ISO-8601)
|
|
516
|
+
* @param {number | string} stopTime - optional range end (epoch ms or ISO-8601)
|
|
517
|
+
* @param {AbortSignal} [signal] - optional abort signal to cancel the request
|
|
518
|
+
* @return {Promise<NodeMetricsHistoryResult | null>} the history, or null if unavailable
|
|
519
|
+
*/
|
|
520
|
+
getNodeMetricsHistory(nodeUri: OceanNode, startTime?: number | string, stopTime?: number | string, signal?: AbortSignal): Promise<NodeMetricsHistoryResult | null>;
|
|
505
521
|
/**
|
|
506
522
|
* Get current nonce from the node via P2P.
|
|
507
523
|
*/
|
|
@@ -665,6 +681,25 @@ export declare class P2pProvider {
|
|
|
665
681
|
getPersistentStorageBuckets(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, owner: string, signal?: AbortSignal): Promise<PersistentStorageBucket[]>;
|
|
666
682
|
listPersistentStorageFiles(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, signal?: AbortSignal): Promise<PersistentStorageFileEntry[]>;
|
|
667
683
|
getPersistentStorageFileObject(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, signal?: AbortSignal): Promise<PersistentStorageObject>;
|
|
684
|
+
/**
|
|
685
|
+
* Downloads a file stored in a persistent-storage bucket over libp2p.
|
|
686
|
+
*
|
|
687
|
+
* The transfer mirrors `getComputeResult`: `dialAndStream` takes a concurrency
|
|
688
|
+
* slot up front, the first frame is a status JSON (an `httpStatus >= 400` throws
|
|
689
|
+
* and releases the slot immediately), and the returned generator streams the file
|
|
690
|
+
* body, applying flow control so a slow consumer does not overrun the buffer. If
|
|
691
|
+
* the caller stops reading early, or `signal` aborts, or the idle timeout fires,
|
|
692
|
+
* the stream is reset so the peer stops sending, and the concurrency slot is
|
|
693
|
+
* released from the generator's `finally`.
|
|
694
|
+
* @param {OceanNode} nodeUri The provider node (peerId / multiaddr).
|
|
695
|
+
* @param {SignerOrAuthTokenOrSignature} signerOrAuthToken Signer, JWT auth token, or precomputed signature used to authenticate the request.
|
|
696
|
+
* @param {string} bucketId The bucket holding the file.
|
|
697
|
+
* @param {string} fileName The name of the file to download.
|
|
698
|
+
* @param {number} [offset=0] Byte offset to resume the download from, sent to the node in the request payload. Must be a non-negative safe integer.
|
|
699
|
+
* @param {AbortSignal} [signal] Abort signal that cancels the download mid-flight and tears down the stream.
|
|
700
|
+
* @return {Promise<ComputeResultStream>} An async-iterable stream of the file body starting at `offset`.
|
|
701
|
+
*/
|
|
702
|
+
downloadPersistentStorageFile(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, offset?: number, signal?: AbortSignal): Promise<ComputeResultStream>;
|
|
668
703
|
uploadPersistentStorageFile(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, content: P2PRequestBodyStream, signal?: AbortSignal): Promise<PersistentStorageFileEntry>;
|
|
669
704
|
deletePersistentStorageFile(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, signal?: AbortSignal): Promise<PersistentStorageDeleteFileResponse>;
|
|
670
705
|
private encryptServiceUserData;
|
|
@@ -672,6 +707,24 @@ export declare class P2pProvider {
|
|
|
672
707
|
serviceStart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, params: ServiceStartParams, signal?: AbortSignal): Promise<ServiceJob[]>;
|
|
673
708
|
serviceStop(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, signal?: AbortSignal): Promise<ServiceJob[]>;
|
|
674
709
|
serviceExtend(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, additionalDuration: number, payment: ServicePayment, signal?: AbortSignal): Promise<ServiceJob[]>;
|
|
710
|
+
/**
|
|
711
|
+
* Restarts a running service (recreates the container) while keeping the same serviceId,
|
|
712
|
+
* payment, resources, host port(s) and expiry.
|
|
713
|
+
*
|
|
714
|
+
* The node treats the restart atomically. Passing no container-spec fields in `params`
|
|
715
|
+
* (REUSE mode) bounces the container on its stored spec unchanged. Passing ANY of
|
|
716
|
+
* `image`/`tag`/`checksum`/`dockerfile`/`additionalDockerFiles` (RESPEC mode) rebuilds the
|
|
717
|
+
* container entirely from `params`: `image` becomes mandatory, exactly one of
|
|
718
|
+
* `tag`/`checksum`/`dockerfile` applies, and a `dockerfile` requires `allowImageBuild` on
|
|
719
|
+
* the env (else the node replies 403). `userData`/`dockerCmd`/`dockerEntrypoint` are only
|
|
720
|
+
* sent when supplied — an omitted override reuses the node's stored value, whereas an
|
|
721
|
+
* explicit value (including `[]`) REPLACES it (matches ocean-node's restartService semantics).
|
|
722
|
+
*
|
|
723
|
+
* `params.metadata` is an optional owner-supplied label bag that, when supplied, REPLACES the
|
|
724
|
+
* stored metadata (and does NOT force RESPEC mode). Unlike `userData`, it is transmitted
|
|
725
|
+
* WITHOUT application-level encryption, so it must not contain sensitive values.
|
|
726
|
+
* @return {Promise<ServiceJob[]>} The restarted service job (single-element array).
|
|
727
|
+
*/
|
|
675
728
|
serviceRestart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, params?: ServiceRestartParams, signal?: AbortSignal): Promise<ServiceJob[]>;
|
|
676
729
|
/**
|
|
677
730
|
* @param {boolean} includeMetrics Owner-only runtime metrics (`runtimeMetrics`) on the
|