@rstmdb/client 0.1.0 → 0.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/README.md +12 -12
- package/dist/index.d.cts +85 -1
- package/dist/index.d.ts +85 -1
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -110,18 +110,18 @@ await client.connect();
|
|
|
110
110
|
|
|
111
111
|
### Configuration Options
|
|
112
112
|
|
|
113
|
-
| Option
|
|
114
|
-
|
|
|
115
|
-
| `host`
|
|
116
|
-
| `port`
|
|
117
|
-
| `connectTimeout`
|
|
118
|
-
| `requestTimeout`
|
|
119
|
-
| `authToken`
|
|
120
|
-
| `tls`
|
|
121
|
-
| `reconnect`
|
|
122
|
-
| `reconnectInterval`
|
|
123
|
-
| `reconnectMaxAttempts` | `10`
|
|
124
|
-
| `clientName`
|
|
113
|
+
| Option | Default | Description |
|
|
114
|
+
| ------ | ------- | ----------- |
|
|
115
|
+
| `host` | required | Server hostname |
|
|
116
|
+
| `port` | `7401` | Server port |
|
|
117
|
+
| `connectTimeout` | `10000` | Connection timeout (ms) |
|
|
118
|
+
| `requestTimeout` | `30000` | Request timeout (ms) |
|
|
119
|
+
| `authToken` | - | Bearer token for authentication |
|
|
120
|
+
| `tls` | - | `true` for system CA, or TlsConfig |
|
|
121
|
+
| `reconnect` | `true` | Auto-reconnect on disconnect |
|
|
122
|
+
| `reconnectInterval` | `1000` | Initial reconnect delay (ms) |
|
|
123
|
+
| `reconnectMaxAttempts` | `10` | Max reconnection attempts |
|
|
124
|
+
| `clientName` | - | Client identifier in handshake |
|
|
125
125
|
|
|
126
126
|
## API Reference
|
|
127
127
|
|
package/dist/index.d.cts
CHANGED
|
@@ -346,6 +346,7 @@ declare enum ErrorCode {
|
|
|
346
346
|
NOT_FOUND = "NOT_FOUND",
|
|
347
347
|
MACHINE_NOT_FOUND = "MACHINE_NOT_FOUND",
|
|
348
348
|
MACHINE_VERSION_EXISTS = "MACHINE_VERSION_EXISTS",
|
|
349
|
+
MACHINE_VERSION_LIMIT_EXCEEDED = "MACHINE_VERSION_LIMIT_EXCEEDED",
|
|
349
350
|
INSTANCE_NOT_FOUND = "INSTANCE_NOT_FOUND",
|
|
350
351
|
INSTANCE_EXISTS = "INSTANCE_EXISTS",
|
|
351
352
|
INVALID_TRANSITION = "INVALID_TRANSITION",
|
|
@@ -533,6 +534,79 @@ interface CompactResult {
|
|
|
533
534
|
/** Bytes reclaimed */
|
|
534
535
|
bytesReclaimed: bigint;
|
|
535
536
|
}
|
|
537
|
+
/**
|
|
538
|
+
* Options for LIST_INSTANCES operation.
|
|
539
|
+
*/
|
|
540
|
+
interface ListInstancesOptions {
|
|
541
|
+
/** Filter by machine name */
|
|
542
|
+
machine?: string;
|
|
543
|
+
/** Filter by current state */
|
|
544
|
+
state?: string;
|
|
545
|
+
/** Maximum number of instances to return */
|
|
546
|
+
limit?: number;
|
|
547
|
+
/** Number of instances to skip (for pagination) */
|
|
548
|
+
offset?: number;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Instance summary for list responses (excludes ctx for efficiency).
|
|
552
|
+
*/
|
|
553
|
+
interface InstanceSummary {
|
|
554
|
+
/** Instance ID */
|
|
555
|
+
id: string;
|
|
556
|
+
/** Machine name */
|
|
557
|
+
machine: string;
|
|
558
|
+
/** Machine version */
|
|
559
|
+
version: number;
|
|
560
|
+
/** Current state */
|
|
561
|
+
state: string;
|
|
562
|
+
/** Creation timestamp (Unix ms) */
|
|
563
|
+
createdAt: number;
|
|
564
|
+
/** Last update timestamp (Unix ms) */
|
|
565
|
+
updatedAt: number;
|
|
566
|
+
/** Last WAL offset */
|
|
567
|
+
lastWalOffset: bigint;
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Result of LIST_INSTANCES operation.
|
|
571
|
+
*/
|
|
572
|
+
interface ListInstancesResult {
|
|
573
|
+
/** List of instance summaries */
|
|
574
|
+
instances: InstanceSummary[];
|
|
575
|
+
/** Total number of matching instances */
|
|
576
|
+
total: number;
|
|
577
|
+
/** Whether more instances exist beyond the limit */
|
|
578
|
+
hasMore: boolean;
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* WAL I/O statistics.
|
|
582
|
+
*/
|
|
583
|
+
interface WalIoStats {
|
|
584
|
+
/** Total bytes written */
|
|
585
|
+
bytesWritten: number;
|
|
586
|
+
/** Total bytes read */
|
|
587
|
+
bytesRead: number;
|
|
588
|
+
/** Number of write operations */
|
|
589
|
+
writes: number;
|
|
590
|
+
/** Number of read operations */
|
|
591
|
+
reads: number;
|
|
592
|
+
/** Number of fsync calls */
|
|
593
|
+
fsyncs: number;
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Result of WAL_STATS operation.
|
|
597
|
+
*/
|
|
598
|
+
interface WalStatsResult {
|
|
599
|
+
/** Total number of entries in WAL */
|
|
600
|
+
entryCount: number;
|
|
601
|
+
/** Number of WAL segments */
|
|
602
|
+
segmentCount: number;
|
|
603
|
+
/** Total size of WAL in bytes */
|
|
604
|
+
totalSizeBytes: number;
|
|
605
|
+
/** Latest WAL offset */
|
|
606
|
+
latestOffset?: bigint;
|
|
607
|
+
/** I/O statistics */
|
|
608
|
+
ioStats: WalIoStats;
|
|
609
|
+
}
|
|
536
610
|
|
|
537
611
|
/**
|
|
538
612
|
* Client events.
|
|
@@ -646,6 +720,10 @@ declare class Client extends EventEmitter {
|
|
|
646
720
|
* Delete an instance.
|
|
647
721
|
*/
|
|
648
722
|
deleteInstance(instanceId: string, options?: DeleteInstanceOptions): Promise<void>;
|
|
723
|
+
/**
|
|
724
|
+
* List instances with optional filtering and pagination.
|
|
725
|
+
*/
|
|
726
|
+
listInstances(options?: ListInstancesOptions): Promise<ListInstancesResult>;
|
|
649
727
|
/**
|
|
650
728
|
* Apply an event to an instance.
|
|
651
729
|
*/
|
|
@@ -658,6 +736,10 @@ declare class Client extends EventEmitter {
|
|
|
658
736
|
* Read entries from the write-ahead log.
|
|
659
737
|
*/
|
|
660
738
|
walRead(fromOffset: bigint, options?: WalReadOptions): Promise<WalReadResult>;
|
|
739
|
+
/**
|
|
740
|
+
* Get WAL statistics.
|
|
741
|
+
*/
|
|
742
|
+
walStats(): Promise<WalStatsResult>;
|
|
661
743
|
/**
|
|
662
744
|
* Create a snapshot of an instance.
|
|
663
745
|
*/
|
|
@@ -874,10 +956,12 @@ declare enum Operation {
|
|
|
874
956
|
LIST_MACHINES = "LIST_MACHINES",
|
|
875
957
|
CREATE_INSTANCE = "CREATE_INSTANCE",
|
|
876
958
|
GET_INSTANCE = "GET_INSTANCE",
|
|
959
|
+
LIST_INSTANCES = "LIST_INSTANCES",
|
|
877
960
|
DELETE_INSTANCE = "DELETE_INSTANCE",
|
|
878
961
|
APPLY_EVENT = "APPLY_EVENT",
|
|
879
962
|
BATCH = "BATCH",
|
|
880
963
|
WAL_READ = "WAL_READ",
|
|
964
|
+
WAL_STATS = "WAL_STATS",
|
|
881
965
|
SNAPSHOT_INSTANCE = "SNAPSHOT_INSTANCE",
|
|
882
966
|
COMPACT = "COMPACT",
|
|
883
967
|
WATCH_INSTANCE = "WATCH_INSTANCE",
|
|
@@ -885,4 +969,4 @@ declare enum Operation {
|
|
|
885
969
|
UNWATCH = "UNWATCH"
|
|
886
970
|
}
|
|
887
971
|
|
|
888
|
-
export { type ApplyEventOptions, type ApplyEventResult, AuthenticationError, type BatchOperation, type BatchOptions, type BatchResult, type BatchResultItem, Client, type ClientConfig, type ClientEvents, ClientOptions, type CompactOptions, type CompactResult, ConflictError, ConnectionError, type CreateInstanceOptions, type CreateInstanceResult, DEFAULT_CONFIG, type DeleteInstanceOptions, ErrorCode, FRAME_MAGIC, type Frame, FrameDecoder, FrameEncoder, FrameFlags, type GetInstanceResult, type GetMachineResult, GuardFailedError, HEADER_SIZE, InvalidTransitionError, type ListMachinesOptions, type ListMachinesResult, type MachineDefinition, type MachineListItem, NotFoundError, Operation, PROTOCOL_VERSION, ProtocolError, type PutMachineResult, type ResolvedConfig, RstmdbError, ServerError, type ServerInfo, type SnapshotResult, type StreamEvent, type Subscription, TimeoutError, type TlsConfig, type Transition, type WalEntry, type WalReadOptions, type WalReadResult, type WatchAllOptions, type WatchOptions };
|
|
972
|
+
export { type ApplyEventOptions, type ApplyEventResult, AuthenticationError, type BatchOperation, type BatchOptions, type BatchResult, type BatchResultItem, Client, type ClientConfig, type ClientEvents, ClientOptions, type CompactOptions, type CompactResult, ConflictError, ConnectionError, type CreateInstanceOptions, type CreateInstanceResult, DEFAULT_CONFIG, type DeleteInstanceOptions, ErrorCode, FRAME_MAGIC, type Frame, FrameDecoder, FrameEncoder, FrameFlags, type GetInstanceResult, type GetMachineResult, GuardFailedError, HEADER_SIZE, type InstanceSummary, InvalidTransitionError, type ListInstancesOptions, type ListInstancesResult, type ListMachinesOptions, type ListMachinesResult, type MachineDefinition, type MachineListItem, NotFoundError, Operation, PROTOCOL_VERSION, ProtocolError, type PutMachineResult, type ResolvedConfig, RstmdbError, ServerError, type ServerInfo, type SnapshotResult, type StreamEvent, type Subscription, TimeoutError, type TlsConfig, type Transition, type WalEntry, type WalIoStats, type WalReadOptions, type WalReadResult, type WalStatsResult, type WatchAllOptions, type WatchOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -346,6 +346,7 @@ declare enum ErrorCode {
|
|
|
346
346
|
NOT_FOUND = "NOT_FOUND",
|
|
347
347
|
MACHINE_NOT_FOUND = "MACHINE_NOT_FOUND",
|
|
348
348
|
MACHINE_VERSION_EXISTS = "MACHINE_VERSION_EXISTS",
|
|
349
|
+
MACHINE_VERSION_LIMIT_EXCEEDED = "MACHINE_VERSION_LIMIT_EXCEEDED",
|
|
349
350
|
INSTANCE_NOT_FOUND = "INSTANCE_NOT_FOUND",
|
|
350
351
|
INSTANCE_EXISTS = "INSTANCE_EXISTS",
|
|
351
352
|
INVALID_TRANSITION = "INVALID_TRANSITION",
|
|
@@ -533,6 +534,79 @@ interface CompactResult {
|
|
|
533
534
|
/** Bytes reclaimed */
|
|
534
535
|
bytesReclaimed: bigint;
|
|
535
536
|
}
|
|
537
|
+
/**
|
|
538
|
+
* Options for LIST_INSTANCES operation.
|
|
539
|
+
*/
|
|
540
|
+
interface ListInstancesOptions {
|
|
541
|
+
/** Filter by machine name */
|
|
542
|
+
machine?: string;
|
|
543
|
+
/** Filter by current state */
|
|
544
|
+
state?: string;
|
|
545
|
+
/** Maximum number of instances to return */
|
|
546
|
+
limit?: number;
|
|
547
|
+
/** Number of instances to skip (for pagination) */
|
|
548
|
+
offset?: number;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Instance summary for list responses (excludes ctx for efficiency).
|
|
552
|
+
*/
|
|
553
|
+
interface InstanceSummary {
|
|
554
|
+
/** Instance ID */
|
|
555
|
+
id: string;
|
|
556
|
+
/** Machine name */
|
|
557
|
+
machine: string;
|
|
558
|
+
/** Machine version */
|
|
559
|
+
version: number;
|
|
560
|
+
/** Current state */
|
|
561
|
+
state: string;
|
|
562
|
+
/** Creation timestamp (Unix ms) */
|
|
563
|
+
createdAt: number;
|
|
564
|
+
/** Last update timestamp (Unix ms) */
|
|
565
|
+
updatedAt: number;
|
|
566
|
+
/** Last WAL offset */
|
|
567
|
+
lastWalOffset: bigint;
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Result of LIST_INSTANCES operation.
|
|
571
|
+
*/
|
|
572
|
+
interface ListInstancesResult {
|
|
573
|
+
/** List of instance summaries */
|
|
574
|
+
instances: InstanceSummary[];
|
|
575
|
+
/** Total number of matching instances */
|
|
576
|
+
total: number;
|
|
577
|
+
/** Whether more instances exist beyond the limit */
|
|
578
|
+
hasMore: boolean;
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* WAL I/O statistics.
|
|
582
|
+
*/
|
|
583
|
+
interface WalIoStats {
|
|
584
|
+
/** Total bytes written */
|
|
585
|
+
bytesWritten: number;
|
|
586
|
+
/** Total bytes read */
|
|
587
|
+
bytesRead: number;
|
|
588
|
+
/** Number of write operations */
|
|
589
|
+
writes: number;
|
|
590
|
+
/** Number of read operations */
|
|
591
|
+
reads: number;
|
|
592
|
+
/** Number of fsync calls */
|
|
593
|
+
fsyncs: number;
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Result of WAL_STATS operation.
|
|
597
|
+
*/
|
|
598
|
+
interface WalStatsResult {
|
|
599
|
+
/** Total number of entries in WAL */
|
|
600
|
+
entryCount: number;
|
|
601
|
+
/** Number of WAL segments */
|
|
602
|
+
segmentCount: number;
|
|
603
|
+
/** Total size of WAL in bytes */
|
|
604
|
+
totalSizeBytes: number;
|
|
605
|
+
/** Latest WAL offset */
|
|
606
|
+
latestOffset?: bigint;
|
|
607
|
+
/** I/O statistics */
|
|
608
|
+
ioStats: WalIoStats;
|
|
609
|
+
}
|
|
536
610
|
|
|
537
611
|
/**
|
|
538
612
|
* Client events.
|
|
@@ -646,6 +720,10 @@ declare class Client extends EventEmitter {
|
|
|
646
720
|
* Delete an instance.
|
|
647
721
|
*/
|
|
648
722
|
deleteInstance(instanceId: string, options?: DeleteInstanceOptions): Promise<void>;
|
|
723
|
+
/**
|
|
724
|
+
* List instances with optional filtering and pagination.
|
|
725
|
+
*/
|
|
726
|
+
listInstances(options?: ListInstancesOptions): Promise<ListInstancesResult>;
|
|
649
727
|
/**
|
|
650
728
|
* Apply an event to an instance.
|
|
651
729
|
*/
|
|
@@ -658,6 +736,10 @@ declare class Client extends EventEmitter {
|
|
|
658
736
|
* Read entries from the write-ahead log.
|
|
659
737
|
*/
|
|
660
738
|
walRead(fromOffset: bigint, options?: WalReadOptions): Promise<WalReadResult>;
|
|
739
|
+
/**
|
|
740
|
+
* Get WAL statistics.
|
|
741
|
+
*/
|
|
742
|
+
walStats(): Promise<WalStatsResult>;
|
|
661
743
|
/**
|
|
662
744
|
* Create a snapshot of an instance.
|
|
663
745
|
*/
|
|
@@ -874,10 +956,12 @@ declare enum Operation {
|
|
|
874
956
|
LIST_MACHINES = "LIST_MACHINES",
|
|
875
957
|
CREATE_INSTANCE = "CREATE_INSTANCE",
|
|
876
958
|
GET_INSTANCE = "GET_INSTANCE",
|
|
959
|
+
LIST_INSTANCES = "LIST_INSTANCES",
|
|
877
960
|
DELETE_INSTANCE = "DELETE_INSTANCE",
|
|
878
961
|
APPLY_EVENT = "APPLY_EVENT",
|
|
879
962
|
BATCH = "BATCH",
|
|
880
963
|
WAL_READ = "WAL_READ",
|
|
964
|
+
WAL_STATS = "WAL_STATS",
|
|
881
965
|
SNAPSHOT_INSTANCE = "SNAPSHOT_INSTANCE",
|
|
882
966
|
COMPACT = "COMPACT",
|
|
883
967
|
WATCH_INSTANCE = "WATCH_INSTANCE",
|
|
@@ -885,4 +969,4 @@ declare enum Operation {
|
|
|
885
969
|
UNWATCH = "UNWATCH"
|
|
886
970
|
}
|
|
887
971
|
|
|
888
|
-
export { type ApplyEventOptions, type ApplyEventResult, AuthenticationError, type BatchOperation, type BatchOptions, type BatchResult, type BatchResultItem, Client, type ClientConfig, type ClientEvents, ClientOptions, type CompactOptions, type CompactResult, ConflictError, ConnectionError, type CreateInstanceOptions, type CreateInstanceResult, DEFAULT_CONFIG, type DeleteInstanceOptions, ErrorCode, FRAME_MAGIC, type Frame, FrameDecoder, FrameEncoder, FrameFlags, type GetInstanceResult, type GetMachineResult, GuardFailedError, HEADER_SIZE, InvalidTransitionError, type ListMachinesOptions, type ListMachinesResult, type MachineDefinition, type MachineListItem, NotFoundError, Operation, PROTOCOL_VERSION, ProtocolError, type PutMachineResult, type ResolvedConfig, RstmdbError, ServerError, type ServerInfo, type SnapshotResult, type StreamEvent, type Subscription, TimeoutError, type TlsConfig, type Transition, type WalEntry, type WalReadOptions, type WalReadResult, type WatchAllOptions, type WatchOptions };
|
|
972
|
+
export { type ApplyEventOptions, type ApplyEventResult, AuthenticationError, type BatchOperation, type BatchOptions, type BatchResult, type BatchResultItem, Client, type ClientConfig, type ClientEvents, ClientOptions, type CompactOptions, type CompactResult, ConflictError, ConnectionError, type CreateInstanceOptions, type CreateInstanceResult, DEFAULT_CONFIG, type DeleteInstanceOptions, ErrorCode, FRAME_MAGIC, type Frame, FrameDecoder, FrameEncoder, FrameFlags, type GetInstanceResult, type GetMachineResult, GuardFailedError, HEADER_SIZE, type InstanceSummary, InvalidTransitionError, type ListInstancesOptions, type ListInstancesResult, type ListMachinesOptions, type ListMachinesResult, type MachineDefinition, type MachineListItem, NotFoundError, Operation, PROTOCOL_VERSION, ProtocolError, type PutMachineResult, type ResolvedConfig, RstmdbError, ServerError, type ServerInfo, type SnapshotResult, type StreamEvent, type Subscription, TimeoutError, type TlsConfig, type Transition, type WalEntry, type WalIoStats, type WalReadOptions, type WalReadResult, type WalStatsResult, type WatchAllOptions, type WatchOptions };
|
package/dist/index.js
CHANGED
|
@@ -65,6 +65,7 @@ var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
|
|
|
65
65
|
ErrorCode2["NOT_FOUND"] = "NOT_FOUND";
|
|
66
66
|
ErrorCode2["MACHINE_NOT_FOUND"] = "MACHINE_NOT_FOUND";
|
|
67
67
|
ErrorCode2["MACHINE_VERSION_EXISTS"] = "MACHINE_VERSION_EXISTS";
|
|
68
|
+
ErrorCode2["MACHINE_VERSION_LIMIT_EXCEEDED"] = "MACHINE_VERSION_LIMIT_EXCEEDED";
|
|
68
69
|
ErrorCode2["INSTANCE_NOT_FOUND"] = "INSTANCE_NOT_FOUND";
|
|
69
70
|
ErrorCode2["INSTANCE_EXISTS"] = "INSTANCE_EXISTS";
|
|
70
71
|
ErrorCode2["INVALID_TRANSITION"] = "INVALID_TRANSITION";
|
|
@@ -343,10 +344,12 @@ var Operation = /* @__PURE__ */ ((Operation2) => {
|
|
|
343
344
|
Operation2["LIST_MACHINES"] = "LIST_MACHINES";
|
|
344
345
|
Operation2["CREATE_INSTANCE"] = "CREATE_INSTANCE";
|
|
345
346
|
Operation2["GET_INSTANCE"] = "GET_INSTANCE";
|
|
347
|
+
Operation2["LIST_INSTANCES"] = "LIST_INSTANCES";
|
|
346
348
|
Operation2["DELETE_INSTANCE"] = "DELETE_INSTANCE";
|
|
347
349
|
Operation2["APPLY_EVENT"] = "APPLY_EVENT";
|
|
348
350
|
Operation2["BATCH"] = "BATCH";
|
|
349
351
|
Operation2["WAL_READ"] = "WAL_READ";
|
|
352
|
+
Operation2["WAL_STATS"] = "WAL_STATS";
|
|
350
353
|
Operation2["SNAPSHOT_INSTANCE"] = "SNAPSHOT_INSTANCE";
|
|
351
354
|
Operation2["COMPACT"] = "COMPACT";
|
|
352
355
|
Operation2["WATCH_INSTANCE"] = "WATCH_INSTANCE";
|
|
@@ -1143,6 +1146,30 @@ var Client = class _Client extends events.EventEmitter {
|
|
|
1143
1146
|
if (options?.idempotencyKey) params["idempotency_key"] = options.idempotencyKey;
|
|
1144
1147
|
await this.connection.request("DELETE_INSTANCE" /* DELETE_INSTANCE */, params);
|
|
1145
1148
|
}
|
|
1149
|
+
/**
|
|
1150
|
+
* List instances with optional filtering and pagination.
|
|
1151
|
+
*/
|
|
1152
|
+
async listInstances(options) {
|
|
1153
|
+
const params = {};
|
|
1154
|
+
if (options?.machine) params["machine"] = options.machine;
|
|
1155
|
+
if (options?.state) params["state"] = options.state;
|
|
1156
|
+
if (options?.limit !== void 0) params["limit"] = options.limit;
|
|
1157
|
+
if (options?.offset !== void 0) params["offset"] = options.offset;
|
|
1158
|
+
const result = await this.connection.request("LIST_INSTANCES" /* LIST_INSTANCES */, params);
|
|
1159
|
+
return {
|
|
1160
|
+
instances: result.instances.map((inst) => ({
|
|
1161
|
+
id: inst.id,
|
|
1162
|
+
machine: inst.machine,
|
|
1163
|
+
version: inst.version,
|
|
1164
|
+
state: inst.state,
|
|
1165
|
+
createdAt: inst.created_at,
|
|
1166
|
+
updatedAt: inst.updated_at,
|
|
1167
|
+
lastWalOffset: BigInt(inst.last_wal_offset)
|
|
1168
|
+
})),
|
|
1169
|
+
total: result.total,
|
|
1170
|
+
hasMore: result.has_more
|
|
1171
|
+
};
|
|
1172
|
+
}
|
|
1146
1173
|
// ─────────────────────────────────────────────────────────────────────────
|
|
1147
1174
|
// Event Operations
|
|
1148
1175
|
// ─────────────────────────────────────────────────────────────────────────
|
|
@@ -1216,6 +1243,25 @@ var Client = class _Client extends events.EventEmitter {
|
|
|
1216
1243
|
nextOffset: result.nextOffset ? BigInt(result.nextOffset) : void 0
|
|
1217
1244
|
};
|
|
1218
1245
|
}
|
|
1246
|
+
/**
|
|
1247
|
+
* Get WAL statistics.
|
|
1248
|
+
*/
|
|
1249
|
+
async walStats() {
|
|
1250
|
+
const result = await this.connection.request("WAL_STATS" /* WAL_STATS */);
|
|
1251
|
+
return {
|
|
1252
|
+
entryCount: result.entry_count,
|
|
1253
|
+
segmentCount: result.segment_count,
|
|
1254
|
+
totalSizeBytes: result.total_size_bytes,
|
|
1255
|
+
latestOffset: result.latest_offset !== void 0 ? BigInt(result.latest_offset) : void 0,
|
|
1256
|
+
ioStats: {
|
|
1257
|
+
bytesWritten: result.io_stats.bytes_written,
|
|
1258
|
+
bytesRead: result.io_stats.bytes_read,
|
|
1259
|
+
writes: result.io_stats.writes,
|
|
1260
|
+
reads: result.io_stats.reads,
|
|
1261
|
+
fsyncs: result.io_stats.fsyncs
|
|
1262
|
+
}
|
|
1263
|
+
};
|
|
1264
|
+
}
|
|
1219
1265
|
/**
|
|
1220
1266
|
* Create a snapshot of an instance.
|
|
1221
1267
|
*/
|