UNPKG

@hotmeshio/hotmesh

Version:

Serverless Workflow

67 lines (66 loc) 4.37 kB
import { KeyStoreParams, KeyType } from '../types/hotmesh'; /** * Keys * * hmsh -> {hash} hotmesh config {version: "0.0.1", namespace: "hmsh"} * hmsh:a:<appid> -> {hash} app profile { "id": "appid", "version": "2", "versions/1": "GMT", "versions/2": "GMT"} * hmsh:<appid>:r: -> {hash} throttle rates {':': '23', 'topic.thing': '555'} => {':i': 'all', 'topic.thing': '555seconds'} * hmsh:<appid>:w: -> {zset} work items/tasks an engine must do like garbage collect or hook a set of matching records (hookAll) * hmsh:<appid>:t: -> {zset} an ordered set of list (work lists) ids * hmsh:<appid>:t:<timeValue?> -> {list} a worklist of `jobId+activityId` items that should be awakened * hmsh:<appid>:q: -> {hash} quorum-wide messages * hmsh:<appid>:q:<ngnid> -> {hash} engine-targeted messages (targeted quorum-oriented message) * hmsh:<appid>:j:<jobid> -> {hash} job data * hmsh:<appid>:s:<jobkey>:<dateTime> -> {hash} job stats (general) * hmsh:<appid>:s:<jobkey>:<dateTime>:mdn:<field/path>:<fieldvalue> -> {zset} job stats (median) * hmsh:<appid>:s:<jobkey>:<dateTime>:index:<field/path>:<fieldvalue> -> {list} job stats (index of jobid[]) * hmsh:<appid>:v:<version>:activities -> {hash} schemas [cache] * hmsh:<appid>:v:<version>:transitions -> {hash} transitions [cache] * hmsh:<appid>:v:<version>:subscriptions -> {hash} subscriptions [cache] * hmsh:<appid>:x: -> {xstream} when an engine is sent or reads a buffered task (engines read from their custom topic) * hmsh:<appid>:x:<topic> -> {xstream} when a worker is sent or reads a buffered task (workers read from their custom topic) * hmsh:<appid>:hooks -> {hash} hook patterns/rules; set at compile time * hmsh:<appid>:signals -> {string} dynamic hook signals (hget/hdel); expirable * hmsh:<appid>:sym:keys: -> {hash} list of symbol ranges and :cursor assigned at version deploy time for job keys * hmsh:<appid>:sym:keys:<activityid|$subscribes> -> {hash} list of symbols based upon schema enums (initially) and adaptively optimized (later) during runtime; if '$subscribes' is used as the activityid, it is a top-level `job` symbol set (for job keys) * hmsh:<appid>:sym:vals: -> {hash} list of symbols for job values across all app versions */ declare const HMNS = "hmsh"; declare const KEYSEP = ":"; declare const VALSEP = "::"; declare const WEBSEP = "::"; declare const TYPSEP = "::"; declare class KeyService { /** * Returns a key that can be used to access a value in the key/value store * appropriate for the given key type; the keys have an implicit hierarchy * and are used to organize data in the store in a tree-like structure * via the use of colons as separators. * @param namespace * @param keyType * @param params * @returns {string} */ static mintKey(namespace: string, keyType: KeyType, params: KeyStoreParams): string; /** * Extracts the parts of a given key string, safely handling cases where * the 'id' portion may contain additional colons. * @param key - The key to parse. * @returns An object with the parsed key parts. */ static parseKey(key: string): Record<string, string | undefined>; /** * Reconstructs a key string from its parts. * @param parts - An object with the key parts. * @returns The reconstructed key string. */ static reconstituteKey(parts: Record<string, string | undefined>): string; /** * Resolves an entity type abbreviation to a table-friendly name. * @param abbreviation - The abbreviated entity type. * @returns The long-form entity name. */ static resolveEntityType(abbreviation: string, id?: string): string; static resolveAbbreviation(entity: string): string; } export { KeyService, KeyType, KeyStoreParams, HMNS, KEYSEP, TYPSEP, WEBSEP, VALSEP, };