<commit_before>#ifndef LCB_SUBDOCAPI_H
#define LCB_SUBDOCAPI_H

#ifdef __cplusplus
extern "C" {
#endif

/**
 * The following error codes are returned when a certain sub-document
 * manipulation function could not be executed. Traditional memcached
 * errors may also be returned.
 */

typedef enum {
    SUBDOC_STATUS_SUCCESS = 0x00, /* PROTOCOL_BINARY_RESPONSE_SUCCESS*/
    /** Document exists, but the given path was not found in the document */
    SUBDOC_STATUS_PATH_ENOENT = 0x501,
    /** There was a conflict between the data and the path */
    SUBDOC_STATUS_PATH_MISMATCH = 0x502,
    /** The path is not a valid path (i.e. does not parse correctly) */
    SUBDOC_STATUS_PATH_EINVAL = 0x503,
    /** The document reference exists, but is not JSON */
    SUBDOC_STATUS_DOC_NOTJSON = 0x504,
    /**The requested operation required the value did not already exist, but it exists */
    SUBDOC_STATUS_DOC_EEXISTS = 0x505,
    /**The path requested is too long/deep to traverse */
    SUBDOC_STATUS_PATH_E2BIG = 0x506,
    /**The number to increment was too big (could not fit in an int64_t) */
    SUBDOC_STATUS_NUM_E2BIG = 0x507,
    /**Delta is too big (bigger than INT64_MAX) */
    SUBDOC_STATUS_DELTA_E2BIG = 0x508,
    /**Invalid value for insertion. Inserting this value would invalidate
     * the JSON document */
    SUBDOC_STATUS_VALUE_CANTINSERT = 0x509,

    /* MEMCACHED ERROR CODES */
    SUBDOC_STATUS_GLOBAL_ENOMEM = 0x82,
    SUBDOC_STATUS_GLOBAL_ENOSUPPORT = 0x83,
    SUBDOC_STATUS_GLOBAL_EINVAL = 0x04,
} subdoc_ERRORS;

#if 0

/**
 * Command structure for sub-document manipulation. This is a dummy structure
 * as this does not yet exist on the server
 *
 * [ HEADER ]
 * [ KEY ]
 * [ PATH ]
 * [ ?VALUE ]
 */
typedef union {
    struct {
        protocol_binary_request_header header;
        struct {
            /* The length of the path to operate on */
            uint16_t pathlen;
            /* The specific subcommand */
            uint8_t subcmd;
        } body;
    } message;
    uint8_t bytes[24 + 2 + 1]; // i.e. 27 bytes base
} protocol_binary_request_subdoc;

/**
 * TODO: We might want to allow multiple commands in a single frame. This will
 * not make directly make execution any quicker on the server side (each command
 * is executed individually) but may help save on CAS validation, locking,
 * and network times. For example:
 *
 * 1. Insert a field
 * 2. Update a certain "Last-Update"
 */
#endif

/**@name Paths
 * A Sub-Document _PATH_ is a path to the container of the item you want to
 * access. Every JSON primitive is stored either as an array element or a
 * dictionary value. In the case of an array element, the _path_ is the path
 * to the numeric index of the array; in the case of a dictionary value, the
 * _path_ is the path to the string key for the value to be accessed (or
 * modified).
 *<commit_msg>Remove mockup memcached header<commit_after>#ifndef LCB_SUBDOCAPI_H
#define LCB_SUBDOCAPI_H

#ifdef __cplusplus
extern "C" {
#endif

/**
 * The following error codes are returned when a certain sub-document
 * manipulation function could not be executed. Traditional memcached
 * errors may also be returned.
 */

typedef enum {
    SUBDOC_STATUS_SUCCESS = 0x00, /* PROTOCOL_BINARY_RESPONSE_SUCCESS*/
    /** Document exists, but the given path was not found in the document */
    SUBDOC_STATUS_PATH_ENOENT = 0x501,
    /** There was a conflict between the data and the path */
    SUBDOC_STATUS_PATH_MISMATCH = 0x502,
    /** The path is not a valid path (i.e. does not parse correctly) */
    SUBDOC_STATUS_PATH_EINVAL = 0x503,
    /** The document reference exists, but is not JSON */
    SUBDOC_STATUS_DOC_NOTJSON = 0x504,
    /**The requested operation required the value did not already exist, but it exists */
    SUBDOC_STATUS_DOC_EEXISTS = 0x505,
    /**The path requested is too long/deep to traverse */
    SUBDOC_STATUS_PATH_E2BIG = 0x506,
    /**The number to increment was too big (could not fit in an int64_t) */
    SUBDOC_STATUS_NUM_E2BIG = 0x507,
    /**Delta is too big (bigger than INT64_MAX) */
    SUBDOC_STATUS_DELTA_E2BIG = 0x508,
    /**Invalid value for insertion. Inserting this value would invalidate
     * the JSON document */
    SUBDOC_STATUS_VALUE_CANTINSERT = 0x509,

    /* MEMCACHED ERROR CODES */
    SUBDOC_STATUS_GLOBAL_ENOMEM = 0x82,
    SUBDOC_STATUS_GLOBAL_ENOSUPPORT = 0x83,
    SUBDOC_STATUS_GLOBAL_EINVAL = 0x04,
} subdoc_ERRORS;

/**@name Paths
 * A Sub-Document _PATH_ is a path to the container of the item you want to
 * access. Every JSON primitive is stored either as an array element or a
 * dictionary value. In the case of an array element, the _path_ is the path
 * to the numeric index of the array; in the case of a dictionary value, the
 * _path_ is the path to the string key for the value to be accessed (or
 * modified).
 *
{'fraction_non_alphanumeric': 0.07266364759160149, 'fraction_numerical': 0.025319061342116096, 'mean_word_length': 3.2961980548187446, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '868449', 'n_tokens_mistral': 1618, 'n_tokens_neox': 1509, 'n_words': 583}