Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Timeranger2

Timeranger2 is a time-series data storage and retrieval system designed for efficient event tracking and data management. It is a core component of Yuneta, operating based on TimeRanger Philosophy, where data is stored as key-value pairs in flat files with timestamp indexing.

Features

Architecture

Use Cases

Relationship with Yuneta

Timeranger2 is optimized for scenarios where structured time-based data is essential, making it a key component of Yuneta’s ecosystem.

typedef void *tr_queue;
typedef void *q_msg;
static const json_desc_t topic_json_desc[] = {
// Name                 Type    Default     Fillspace
{"on_critical_error",   "int",  "2",        ""}, // Volatil, default LOG_OPT_EXIT_ZERO (Zero to avoid restart)
{"filename_mask",       "str",  "%Y-%m-%d", ""}, // Organization of tables (file name format, see strftime())
{"xpermission" ,        "int",  "02770",    ""}, // Use in creation, default 02770;
{"rpermission",         "int",  "0660",     ""}, // Use in creation, default 0660;
static const json_desc_t tranger2_json_desc[] = {
// Name                 Type    Default     Fillspace
{"path",                "str",  "",         ""}, // If database exists then only needs (path,[database]) params
{"database",            "str",  "",         ""}, // If null, path must contains the 'database'

// Default for topics
{"filename_mask",       "str",  "%Y-%m-%d", ""}, // Organization of tables (file name format, see strftime())
{"xpermission" ,        "int",  "02770",    ""}, // Use in creation, default 02770;
{"rpermission",         "int",  "0660",     ""}, // Use in creation, default 0660;

// Volatil fields
{"on_critical_error",   "int",  "2",        ""}, // Volatil, default LOG_OPT_EXIT_ZERO (Zero to avoid restart)
{"master",              "bool", "false",    ""}, // Volatil, the master is the only that can write.
{"gobj",                "int",  "",         ""}, // Volatil, gobj of tranger
{"trace_level",         "int",  "0",        ""}, // Volatil, trace level

{0}
};
typedef int (*tranger2_load_record_callback_t)(
    json_t *tranger,
    json_t *topic,
    const char *key,
    json_t *list,       // iterator or rt_mem/rt_disk, don't own
    json_int_t rowid,   // in a rt_mem will be the relative rowid, in rt_disk the absolute rowid
    md2_record_ex_t *md_record,
    json_t *jn_record  // must be owned
);

Summary of fs_watcher.h

This header file defines the fs_watcher module, which provides filesystem event watching functionality.

Typedefs

- **Structures:**
  ```c

    typedef struct fs_event_s fs_event_t;

    typedef int (*fs_callback_t)(
        fs_event_t *fs_event
    );

    struct fs_event_s {
        yev_loop_h yev_loop;
        yev_event_h yev_event;
        const char *path;
        fs_flag_t fs_flag;
        fs_type_t fs_type;          // Output
        volatile char *directory;   // Output
        volatile char *filename;    // Output
        hgobj gobj;
        void *user_data;
        void *user_data2;
        fs_callback_t callback;
        int fd;
        json_t *jn_tracked_paths;
    } ;

  ```