jobid format and parse

This commit is contained in:
Rongsong Shen 2025-11-19 14:44:49 +08:00
parent 26e3c21c87
commit 3488b62716
6 changed files with 212 additions and 15 deletions

View file

@ -41,16 +41,21 @@ typedef uint64_t jobid_t;
#define N_ARRAY_IDX_BITS (15)
#define N_SEQENCE_BITS \
#define N_SEQUENCE_BITS \
(N_JOBID_BITS - N_CLUSTER_ID_BITS - N_APISERVER_ID_BITS - N_TIMESTAMP_BITS \
- N_TAG_BITS)
#define SEQUENCE_HIGH_SHIFT (N_ARRAY_IDX_BITS)
#define UMAX_BITS(w) ((((uint64_t)0x01) << (int)w) - 1)
#define N_MAX_FIELDS_JOBID (5)
#define UMAX_BITS(w) ((((uint64_t)0x01) << ((int)w)) - 1)
#define MAX_CLUSTER_ID (UMAX_BITS(N_CLUSTER_ID_BITS))
#define MAX_APISERVER_ID (UMAX_BITS(N_APISERVER_ID_BITS))
#define MAX_ARRAY_IDX (UMAX_BITS(N_ARRAY_IDX_BITS))
#define REGEX_JOBID "[ \t]*([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)[ \t]*"
#define REGEX_JOBARRAY_ID "[ \t]*([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\\[([0-9]+)\\][ \t]*"
#endif