maestro refacto to grrom, getpositions actions transfered to Observer, changed to frustum, with subscription

This commit is contained in:
STEINNI
2026-06-14 10:16:56 +00:00
parent f3102d5fbc
commit c399f9ddb4
21 changed files with 760 additions and 185 deletions
+11 -11
View File
@@ -1,23 +1,23 @@
export class AgentStore {
constructor(systemCnx, storage, debug = false) {
constructor(systemCnx, gpsStorage, debug = false) {
this.cnx = systemCnx
this.storage = storage
this.gpsStorage = gpsStorage
this.debug = debug
}
agentHashKey(agentId) {
return(this.storage.agentHashKey.replace(/\[UID\]/g, agentId))
return(this.gpsStorage.agentHashKey.replace(/\[UID\]/g, agentId))
}
async clearAll() {
try {
const ids = await this.cnx.redisSmembers(this.storage.agentsIndexKey)
const ids = await this.cnx.redisSmembers(this.gpsStorage.agentsIndexKey)
for(const id of ids) {
await this.cnx.redisDel(this.agentHashKey(id))
}
await this.cnx.redisDel(this.storage.agentsIndexKey)
await this.cnx.redisDel(this.gpsStorage.agentsIndexKey)
if(this.debug) console.log(`[GPS] Cleared system agent store (${ids.length} agent(s))`)
} catch(err) {
console.error('[GPS] Failed to clear system agent store:', err)
@@ -37,11 +37,11 @@ export class AgentStore {
simulationId,
}
await this.cnx.redisHset(this.agentHashKey(agent.id), 'segment', record)
await this.cnx.redisSadd(this.storage.agentsIndexKey, agent.id)
await this.cnx.redisSadd(this.gpsStorage.agentsIndexKey, agent.id)
await this.cnx.redisXadd(
this.storage.positionsStream,
this.gpsStorage.positionsStream,
record,
this.storage.streamMaxLen ?? ''
this.gpsStorage.streamMaxLen ?? ''
)
if(this.debug) console.log(`[GPS] Exported segment ${agent.id} (${eventType})`)
} catch(err) {
@@ -57,11 +57,11 @@ export class AgentStore {
t: simT,
}
await this.cnx.redisDel(this.agentHashKey(agentId))
await this.cnx.redisSrem(this.storage.agentsIndexKey, agentId)
await this.cnx.redisSrem(this.gpsStorage.agentsIndexKey, agentId)
await this.cnx.redisXadd(
this.storage.positionsStream,
this.gpsStorage.positionsStream,
record,
this.storage.streamMaxLen ?? ''
this.gpsStorage.streamMaxLen ?? ''
)
if(this.debug) console.log(`[GPS] Exported remove ${agentId}`)
} catch(err) {