mirror of
https://github.com/gadgethd/ukmesh.git
synced 2026-12-06 03:14:09 +00:00
43 lines
2.8 KiB
Python
43 lines
2.8 KiB
Python
# Generated by scripts/generate-shared-contracts.mjs. Edit contracts/ instead.
|
|
READY = "meshcore:link:v3:ready"
|
|
DEFERRED = "meshcore:link:v3:deferred"
|
|
PAYLOADS = "meshcore:link:v3:payloads"
|
|
STATES = "meshcore:link:v3:states"
|
|
ATTEMPTS = "meshcore:link:v3:attempts"
|
|
BYTES = "meshcore:link:v3:bytes"
|
|
DEDUPE = "meshcore:link:v3:dedupe"
|
|
DEDUPE_BY_JOB = "meshcore:link:v3:dedupe_by_job"
|
|
LEASES = "meshcore:link:v3:leases"
|
|
TOKENS = "meshcore:link:v3:tokens"
|
|
DEAD = "meshcore:link:v3:dead"
|
|
DEAD_REASONS = "meshcore:link:v3:dead_reasons"
|
|
ENQUEUED = "meshcore:link:v3:enqueued"
|
|
COMPLETED = "meshcore:link:v3:completed"
|
|
COUNTERS = "meshcore:link:v3:counters"
|
|
REBUILD = "meshcore:link:v3:rebuild"
|
|
WORKER_HEARTBEAT = "meshcore:link:v3:worker_heartbeat"
|
|
EVENTS = "meshcore:link:v3:events"
|
|
WAKE = "meshcore:link:v3:wake"
|
|
ADMIT_KEYS = (READY, PAYLOADS, STATES, ATTEMPTS, BYTES, DEDUPE, DEDUPE_BY_JOB, DEFERRED, REBUILD, COUNTERS, EVENTS, ENQUEUED, WAKE,)
|
|
ADMIT_SCRIPT = "\nlocal existing = redis.call('HGET', KEYS[6], ARGV[2])\nif existing then\n local existing_state = redis.call('HGET', KEYS[3], existing)\n if existing == ARGV[1] and existing_state == 'complete' then\n return {'duplicate', existing}\n end\n if existing_state == 'queued' or existing_state == 'in_flight' or existing_state == 'dead' then\n return {'coalesced', existing}\n end\nend\nlocal payload_bytes = tonumber(ARGV[4])\nif payload_bytes > tonumber(ARGV[7]) then\n return {'oversized', ''}\nend\nlocal count = tonumber(redis.call('HGET', KEYS[10], 'count') or '0')\nlocal bytes = tonumber(redis.call('HGET', KEYS[10], 'bytes') or '0')\nif count + 1 > tonumber(ARGV[5]) or bytes + payload_bytes > tonumber(ARGV[6]) then\n return {'full', ''}\nend\nredis.call('HSET', KEYS[2], ARGV[1], ARGV[3])\nredis.call('HSET', KEYS[3], ARGV[1], 'queued')\nredis.call('HSET', KEYS[4], ARGV[1], '0')\nredis.call('HSET', KEYS[5], ARGV[1], tostring(payload_bytes))\nredis.call('HSET', KEYS[6], ARGV[2], ARGV[1])\nredis.call('HSET', KEYS[7], ARGV[1], ARGV[2])\nredis.call('HINCRBY', KEYS[10], 'count', 1)\nredis.call('HINCRBY', KEYS[10], 'bytes', payload_bytes)\nredis.call('ZADD', KEYS[12], ARGV[9], ARGV[1])\nif ARGV[8] == '' and redis.call('EXISTS', KEYS[9]) == 1 then\n redis.call('LPUSH', KEYS[8], ARGV[1])\nelse\n redis.call('LPUSH', KEYS[1], ARGV[1])\nend\nredis.call('LPUSH', KEYS[11], 'admit')\nredis.call('LTRIM', KEYS[11], 0, 255)\nredis.call('LPUSH', KEYS[13], '1')\nredis.call('LTRIM', KEYS[13], 0, 0)\nreturn {'accepted', ARGV[1]}\n"
|
|
LINK_V3_LIMITS = {
|
|
"maxJobs": {
|
|
"env": "LINK_QUEUE_V3_MAX_JOBS",
|
|
"default": 5000,
|
|
"min": 1,
|
|
"max": 100000
|
|
},
|
|
"maxBytes": {
|
|
"env": "LINK_QUEUE_V3_MAX_BYTES",
|
|
"default": 67108864,
|
|
"min": 1,
|
|
"max": 1073741824
|
|
},
|
|
"maxPayloadBytes": {
|
|
"env": "LINK_QUEUE_V3_MAX_PAYLOAD_BYTES",
|
|
"default": 32768,
|
|
"min": 1,
|
|
"max": 1048576
|
|
}
|
|
}
|