@sentio/runtime 2.59.0-rc.3 → 2.59.0-rc.31

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.
@@ -21,7 +21,7 @@ import {
21
21
  require_roots,
22
22
  require_rpc,
23
23
  require_writer
24
- } from "./chunk-ZUTD563J.js";
24
+ } from "./chunk-FO2V2K7T.js";
25
25
 
26
26
  // ../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js
27
27
  var require_universalify = __commonJS({
@@ -37942,6 +37942,7 @@ function mergeProcessResults(results) {
37942
37942
  res.gauges = res.gauges.concat(r.gauges);
37943
37943
  res.events = res.events.concat(r.events);
37944
37944
  res.exports = res.exports.concat(r.exports);
37945
+ res.timeseriesResult = res.timeseriesResult.concat(r.timeseriesResult);
37945
37946
  res.states = {
37946
37947
  configUpdated: res.states?.configUpdated || r.states?.configUpdated || false
37947
37948
  };
@@ -38127,25 +38128,29 @@ var dbMetrics = {
38127
38128
  get: new C("store_get_send"),
38128
38129
  upsert: new C("store_upsert_send"),
38129
38130
  list: new C("store_list_send"),
38130
- delete: new C("store_delete_send")
38131
+ delete: new C("store_delete_send"),
38132
+ update: new C("store_update_send")
38131
38133
  },
38132
38134
  recv_counts: {
38133
38135
  get: new C("store_get_recv"),
38134
38136
  upsert: new C("store_upsert_recv"),
38135
38137
  list: new C("store_list_recv"),
38136
- delete: new C("store_delete_recv")
38138
+ delete: new C("store_delete_recv"),
38139
+ update: new C("store_update_recv")
38137
38140
  },
38138
38141
  request_times: {
38139
38142
  get: new C("store_get_time"),
38140
38143
  upsert: new C("store_upsert_time"),
38141
38144
  list: new C("store_list_time"),
38142
- delete: new C("store_delete_time")
38145
+ delete: new C("store_delete_time"),
38146
+ update: new C("store_update_time")
38143
38147
  },
38144
38148
  request_errors: {
38145
38149
  get: new C("store_get_error"),
38146
38150
  upsert: new C("store_upsert_error"),
38147
38151
  list: new C("store_list_error"),
38148
- delete: new C("store_delete_error")
38152
+ delete: new C("store_delete_error"),
38153
+ update: new C("store_update_error")
38149
38154
  },
38150
38155
  batched_total_count: new C("batched_total_count"),
38151
38156
  batched_request_count: new C("batched_request_count"),
@@ -59361,10 +59366,12 @@ var ProcessorServiceImpl = class {
59361
59366
  shutdownHandler;
59362
59367
  enablePreprocess;
59363
59368
  preparedData;
59369
+ enablePartition;
59364
59370
  constructor(loader, shutdownHandler) {
59365
59371
  this.loader = loader;
59366
59372
  this.shutdownHandler = shutdownHandler;
59367
59373
  this.enablePreprocess = process.env["ENABLE_PREPROCESS"] ? process.env["ENABLE_PREPROCESS"].toLowerCase() == "true" : false;
59374
+ this.enablePartition = process.env["SENTIO_ENABLE_BINDING_DATA_PARTITION"] == "true";
59368
59375
  }
59369
59376
  async getConfig(request, context2) {
59370
59377
  if (!this.started) {
@@ -59621,6 +59628,7 @@ var ProcessorServiceImpl = class {
59621
59628
  }
59622
59629
  async handleRequests(requests, subject) {
59623
59630
  const contexts = new Contexts();
59631
+ let lastBinding = void 0;
59624
59632
  for await (const request of requests) {
59625
59633
  try {
59626
59634
  if (request.binding) {
@@ -59632,25 +59640,25 @@ var ProcessorServiceImpl = class {
59632
59640
  });
59633
59641
  continue;
59634
59642
  }
59635
- const binding = request.binding;
59636
- const dbContext = contexts.new(request.processId, subject);
59637
- const start = Date.now();
59638
- PluginManager.INSTANCE.processBinding(binding, this.preparedData, dbContext).then(async (result) => {
59639
- await dbContext.awaitPendings();
59640
- subject.next({
59641
- result,
59642
- processId: request.processId
59643
+ lastBinding = request.binding;
59644
+ if (this.enablePartition) {
59645
+ PluginManager.INSTANCE.partition(request.binding).then((partitions) => {
59646
+ subject.next({
59647
+ processId: request.processId,
59648
+ partitions
59649
+ });
59643
59650
  });
59644
- recordRuntimeInfo(result, binding.handlerType);
59645
- }).catch((e) => {
59646
- console.debug(e);
59647
- dbContext.error(request.processId, e);
59648
- process_binding_error.add(1);
59649
- }).finally(() => {
59650
- const cost = Date.now() - start;
59651
- process_binding_time.add(cost);
59652
- contexts.delete(request.processId);
59653
- });
59651
+ } else {
59652
+ this.startProcess(request.processId, request.binding, contexts, subject);
59653
+ }
59654
+ }
59655
+ if (request.start) {
59656
+ if (!lastBinding) {
59657
+ console.error("start request received without binding");
59658
+ subject.error(new Error("start request received without binding"));
59659
+ continue;
59660
+ }
59661
+ this.startProcess(request.processId, lastBinding, contexts, subject);
59654
59662
  }
59655
59663
  if (request.dbResult) {
59656
59664
  const dbContext = contexts.get(request.processId);
@@ -59665,6 +59673,26 @@ var ProcessorServiceImpl = class {
59665
59673
  }
59666
59674
  }
59667
59675
  }
59676
+ startProcess(processId, binding, contexts, subject) {
59677
+ const dbContext = contexts.new(processId, subject);
59678
+ const start = Date.now();
59679
+ PluginManager.INSTANCE.processBinding(binding, this.preparedData, dbContext).then(async (result) => {
59680
+ await dbContext.awaitPendings();
59681
+ subject.next({
59682
+ result,
59683
+ processId
59684
+ });
59685
+ recordRuntimeInfo(result, binding.handlerType);
59686
+ }).catch((e) => {
59687
+ console.error(e);
59688
+ dbContext.error(processId, e);
59689
+ process_binding_error.add(1);
59690
+ }).finally(() => {
59691
+ const cost = Date.now() - start;
59692
+ process_binding_time.add(cost);
59693
+ contexts.delete(processId);
59694
+ });
59695
+ }
59668
59696
  };
59669
59697
  function recordRuntimeInfo(results, handlerType) {
59670
59698
  for (const list of [results.gauges, results.counters, results.events, results.exports]) {
@@ -59830,4 +59858,4 @@ long/umd/index.js:
59830
59858
  @noble/curves/esm/secp256k1.js:
59831
59859
  (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
59832
59860
  */
59833
- //# sourceMappingURL=chunk-QELD44EL.js.map
59861
+ //# sourceMappingURL=chunk-X2VTMTYL.js.map