refactor(export-mesh): extract gossip-wait options builder (Phase 936)
Centralize buildGuildExportMeshGossipWaitOptions in a dedicated module; gossip-wait-build composes entry-bound callbacks; mixin-fetch-once imports options instead of inlining wait config. No observable behavior change. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -178,6 +178,8 @@ Application facade: one `PearcordPlatform` class that wires identity, database,
|
|||||||
|
|
||||||
**Phase 881 (v0.8.848):** Split `gossip-rpc-pull.js` into peer/session/validators/orchestrators/view-snapshot modules; barrel export unchanged. Bundle: `npm run test:ci-phase881`.
|
**Phase 881 (v0.8.848):** Split `gossip-rpc-pull.js` into peer/session/validators/orchestrators/view-snapshot modules; barrel export unchanged. Bundle: `npm run test:ci-phase881`.
|
||||||
|
|
||||||
|
**Phase 936 (v0.8.903):** Export mesh gossip-wait options builder + mixin-fetch-once deps split (non-breaking). Bundle: `npm run test:ci-phase936`.
|
||||||
|
|
||||||
**Phase 935 (v0.8.902):** Export mesh format audit/digest local helpers + validators facade (non-breaking). Bundle: `npm run test:ci-phase935`.
|
**Phase 935 (v0.8.902):** Export mesh format audit/digest local helpers + validators facade (non-breaking). Bundle: `npm run test:ci-phase935`.
|
||||||
|
|
||||||
**Phase 934 (v0.8.901):** Export mesh registry-entry field groups + clone helper extract (non-breaking). Bundle: `npm run test:ci-phase934`.
|
**Phase 934 (v0.8.901):** Export mesh registry-entry field groups + clone helper extract (non-breaking). Bundle: `npm run test:ci-phase934`.
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const { awaitGuildExportMeshGossipWait } = require('./gossip-rpc-export-mesh-gossip-wait')
|
const { awaitGuildExportMeshGossipWait } = require('./gossip-rpc-export-mesh-gossip-wait')
|
||||||
|
const { buildGuildExportMeshGossipWaitOptions } = require('./gossip-rpc-export-mesh-gossip-wait-options')
|
||||||
/** Base fields for export mesh gossip request payloads (Phase 898). */
|
|
||||||
function buildGuildExportMeshGossipRequestBase (platform, opts = {}, requestId) {
|
function buildGuildExportMeshGossipRequestBase (platform, opts = {}, requestId) {
|
||||||
return {
|
return {
|
||||||
guildId: platform.guild.guild.id,
|
guildId: platform.guild.guild.id,
|
||||||
@@ -12,13 +10,16 @@ function buildGuildExportMeshGossipRequestBase (platform, opts = {}, requestId)
|
|||||||
at: Date.now()
|
at: Date.now()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Factory for meshGossipWait callbacks passed to fetchGuildExportMeshResourceOnce (Phase 898). */
|
|
||||||
function buildGuildExportMeshGossipWaitCallback (config) {
|
function buildGuildExportMeshGossipWaitCallback (config) {
|
||||||
return () => awaitGuildExportMeshGossipWait(config)
|
return () => awaitGuildExportMeshGossipWait(config)
|
||||||
}
|
}
|
||||||
|
function buildGuildExportMeshGossipWaitCallbackForEntry (platform, entry, resourceId, opts = {}) {
|
||||||
|
return buildGuildExportMeshGossipWaitCallback(
|
||||||
|
buildGuildExportMeshGossipWaitOptions(platform, entry, resourceId, opts)
|
||||||
|
)
|
||||||
|
}
|
||||||
module.exports = {
|
module.exports = {
|
||||||
buildGuildExportMeshGossipRequestBase,
|
buildGuildExportMeshGossipRequestBase,
|
||||||
buildGuildExportMeshGossipWaitCallback
|
buildGuildExportMeshGossipWaitCallback,
|
||||||
|
buildGuildExportMeshGossipWaitCallbackForEntry
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
'use strict'
|
||||||
|
|
||||||
|
/** Build awaitGuildExportMeshGossipWait config from registry entry + platform (Phase 936). */
|
||||||
|
function buildGuildExportMeshGossipWaitOptions (platform, entry, resourceId, opts = {}) {
|
||||||
|
return {
|
||||||
|
resourceId,
|
||||||
|
opts,
|
||||||
|
waiters: platform[entry.waitersKey],
|
||||||
|
waiterMode: entry.waiterMode,
|
||||||
|
timeoutErrorMessage: entry.timeoutErrorMessage,
|
||||||
|
notFoundMessage: entry.notFoundMessage,
|
||||||
|
sendGossipRequest: (requestId) => entry.sendGossipRequest(platform, resourceId, opts, requestId),
|
||||||
|
refetchLocal: () => entry.getLocalRow(platform, resourceId),
|
||||||
|
validateLocal: entry.validateLocal,
|
||||||
|
formatResult: (fetched) => entry.formatGossipResult(platform, resourceId, opts, fetched)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { buildGuildExportMeshGossipWaitOptions }
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
|
const { buildGuildExportMeshGossipWaitOptions } = require('./gossip-rpc-export-mesh-gossip-wait-options')
|
||||||
const { buildGuildExportMeshGossipWaitCallback } = require('./gossip-rpc-export-mesh-gossip-wait-build')
|
const { buildGuildExportMeshGossipWaitCallback } = require('./gossip-rpc-export-mesh-gossip-wait-build')
|
||||||
const { fetchGuildExportMeshResourceOnce } = require('./gossip-rpc-export-mesh-fetch-once')
|
const { fetchGuildExportMeshResourceOnce } = require('./gossip-rpc-export-mesh-fetch-once')
|
||||||
|
|
||||||
@@ -15,18 +16,9 @@ function buildGuildExportMeshFetchOnceMethod (entry) {
|
|||||||
tryRpc: () => entry.tryRpc(platform, resourceId, opts),
|
tryRpc: () => entry.tryRpc(platform, resourceId, opts),
|
||||||
ingestRpc: (rpc) => entry.ingestRpc(platform, rpc),
|
ingestRpc: (rpc) => entry.ingestRpc(platform, rpc),
|
||||||
formatRpcHit: (rpc) => entry.formatRpcHit(platform, resourceId, opts, rpc),
|
formatRpcHit: (rpc) => entry.formatRpcHit(platform, resourceId, opts, rpc),
|
||||||
meshGossipWait: buildGuildExportMeshGossipWaitCallback({
|
meshGossipWait: buildGuildExportMeshGossipWaitCallback(
|
||||||
resourceId,
|
buildGuildExportMeshGossipWaitOptions(platform, entry, resourceId, opts)
|
||||||
opts,
|
)
|
||||||
waiters: platform[entry.waitersKey],
|
|
||||||
waiterMode: entry.waiterMode,
|
|
||||||
timeoutErrorMessage: entry.timeoutErrorMessage,
|
|
||||||
notFoundMessage: entry.notFoundMessage,
|
|
||||||
sendGossipRequest: (requestId) => entry.sendGossipRequest(platform, resourceId, opts, requestId),
|
|
||||||
refetchLocal: () => entry.getLocalRow(platform, resourceId),
|
|
||||||
validateLocal: entry.validateLocal,
|
|
||||||
formatResult: (fetched) => entry.formatGossipResult(platform, resourceId, opts, fetched)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
const attempt = require('./gossip-rpc-export-mesh-attempt')
|
const attempt = require('./gossip-rpc-export-mesh-attempt')
|
||||||
const retry = require('./gossip-rpc-export-mesh-retry')
|
const retry = require('./gossip-rpc-export-mesh-retry')
|
||||||
const gossipWait = require('./gossip-rpc-export-mesh-gossip-wait')
|
const gossipWait = require('./gossip-rpc-export-mesh-gossip-wait')
|
||||||
|
const gossipWaitOptions = require('./gossip-rpc-export-mesh-gossip-wait-options')
|
||||||
const gossipWaitBuild = require('./gossip-rpc-export-mesh-gossip-wait-build')
|
const gossipWaitBuild = require('./gossip-rpc-export-mesh-gossip-wait-build')
|
||||||
const fetchOnce = require('./gossip-rpc-export-mesh-fetch-once')
|
const fetchOnce = require('./gossip-rpc-export-mesh-fetch-once')
|
||||||
const waiterResolve = require('./gossip-rpc-export-mesh-waiter-resolve')
|
const waiterResolve = require('./gossip-rpc-export-mesh-waiter-resolve')
|
||||||
@@ -75,6 +76,7 @@ module.exports = {
|
|||||||
...attempt,
|
...attempt,
|
||||||
...retry,
|
...retry,
|
||||||
...gossipWait,
|
...gossipWait,
|
||||||
|
...gossipWaitOptions,
|
||||||
...gossipWaitBuild,
|
...gossipWaitBuild,
|
||||||
...fetchOnce,
|
...fetchOnce,
|
||||||
...waiterResolve,
|
...waiterResolve,
|
||||||
|
|||||||
Reference in New Issue
Block a user