Skip to content
pi-c Documentation
Login

Documentation

/* pic attach (attach.c): a read-only view of a conversation another
 * process runs, rebuilt from the journal's committed rows as Pi's JSON
 * events (or a short text form), caught up from a seq and then followed.
 * With -i, each line of stdin goes to the conversation's inbox (inbox.h).
 * It opens the journal narrowly, takes no lease and writes nothing but
 * inbox rows. Streamed text is not journaled, so it shows only committed
 * messages. */
#ifndef PIC_ATTACH_H
#define PIC_ATTACH_H

typedef struct {
    const char *db;      /* the journal */
    const char *session; /* an id, a unique prefix, or "latest" */
    long long from;      /* entries after this seq; -1: from the latest request's start */
    int text;            /* --format text: lines for a person */
    int interactive;     /* -i: stdin lines become steers (follow-ups when idle) */
    int follow;          /* 0 (--no-follow): what is committed, then exit */
} pic_attach_options;

/* The process's exit status: 0, or 1 with a message on stderr. */
int pic_attach_main(const pic_attach_options *o);

#endif