<commit_before>// Copyright 2016 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

#ifndef V23_SYNCBASE_LIB_H_
#define V23_SYNCBASE_LIB_H_

#include <stdbool.h>
#include <stdint.h>

////////////////////////////////////////
// Generic types

typedef uint8_t v23_syncbase_Bool;

// string
typedef struct {
  char* p;
  int n;
} v23_syncbase_String;

// []byte
typedef struct {
  uint8_t* p;
  int n;
} v23_syncbase_Bytes;

// []string
typedef struct {
  v23_syncbase_String* p;
  int n;
} v23_syncbase_Strings;

////////////////////////////////////////
// Vanadium-specific types

// verror.E
typedef struct {
  v23_syncbase_String id;
  unsigned int actionCode;
  v23_syncbase_String msg;
  v23_syncbase_String stack;
} v23_syncbase_VError;

// access.Permissions
// TODO(sadovsky): Decide how to represent perms.
typedef struct {
  v23_syncbase_Bytes json;
} v23_syncbase_Permissions;

////////////////////////////////////////
// Syncbase-specific types

// syncbase.Id
typedef struct {
  v23_syncbase_String blessing;
  v23_syncbase_String name;
} v23_syncbase_Id;

// []syncbase.Id
typedef struct {
  v23_syncbase_Id* p;
  int n;
} v23_syncbase_Ids;

// syncbase.BatchOptions
typedef struct {
  v23_syncbase_String hint;
  bool readOnly;
} v23_syncbase_BatchOptions;

// syncbase.CollectionRowPattern
typedef struct {
  v23_syncbase_String collectionBlessing;
  v23_syncbase_String collectionName;
  v23_syncbase_String rowKey;
} v23_syncbase_CollectionRowPattern;

// []syncbase.CollectionRowPattern
typedef struct {
  v23_syncbase_CollectionRowPattern* p;
  int n;
} v23_syncbase_CollectionRowPatterns;

typedef enum v23_syncbase_ChangeType {
  kPut = 0,
  kDelete = 1
} v23_syncbase_ChangeType;

// syncbase.WatchChange
typedef struct {
  v23_syncbase_Id collection;
  v23_syncbase_String row;
  v23_syncbase_ChangeType changeType;
  v23_syncbase_Bytes value;
  v23_syncbase_String resumeMarker;
  bool fromSync;
  bool continued;
} v23_syncbase_WatchChange;

// syncbase.KeyValue
typedef struct {
  v23_syncbase_String key;
  v23_syncbase_Bytes value;
} v23_syncbase_KeyValue;

// syncbase.SyncgroupSpec
typedef struct {
  v23_syncbase_String description;
  v23_syncbase_String publishSyncbaseName;
  v23_syncbase_Permissions perms;
  v23_syncbase_Ids collections;<commit_msg>swift: Support watch API<commit_after>// Copyright 2016 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

#ifndef V23_SYNCBASE_LIB_H_
#define V23_SYNCBASE_LIB_H_

#include <stdbool.h>
#include <stdint.h>

////////////////////////////////////////
// Generic types

typedef uint8_t v23_syncbase_Bool;

// string
typedef struct {
  char* p;
  int n;
} v23_syncbase_String;

// []byte
typedef struct {
  uint8_t* p;
  int n;
} v23_syncbase_Bytes;

// []string
typedef struct {
  v23_syncbase_String* p;
  int n;
} v23_syncbase_Strings;

////////////////////////////////////////
// Vanadium-specific types

// verror.E
typedef struct {
  v23_syncbase_String id;
  unsigned int actionCode;
  v23_syncbase_String msg;
  v23_syncbase_String stack;
} v23_syncbase_VError;

// access.Permissions
// TODO(sadovsky): Decide how to represent perms.
typedef struct {
  v23_syncbase_Bytes json;
} v23_syncbase_Permissions;

////////////////////////////////////////
// Syncbase-specific types

// syncbase.Id
typedef struct {
  v23_syncbase_String blessing;
  v23_syncbase_String name;
} v23_syncbase_Id;

// []syncbase.Id
typedef struct {
  v23_syncbase_Id* p;
  int n;
} v23_syncbase_Ids;

// syncbase.BatchOptions
typedef struct {
  v23_syncbase_String hint;
  bool readOnly;
} v23_syncbase_BatchOptions;

// syncbase.CollectionRowPattern
typedef struct {
  v23_syncbase_String collectionBlessing;
  v23_syncbase_String collectionName;
  v23_syncbase_String rowKey;
} v23_syncbase_CollectionRowPattern;

// []syncbase.CollectionRowPattern
typedef struct {
  v23_syncbase_CollectionRowPattern* p;
  int n;
} v23_syncbase_CollectionRowPatterns;

// syncbase.ChangeType
typedef enum v23_syncbase_ChangeType {
  v23_syncbase_ChangeTypePut = 0,
  v23_syncbase_ChangeTypeDelete = 1
} v23_syncbase_ChangeType;

// syncbase.WatchChange
typedef struct {
  v23_syncbase_Id collection;
  v23_syncbase_String row;
  v23_syncbase_ChangeType changeType;
  v23_syncbase_Bytes value;
  v23_syncbase_String resumeMarker;
  bool fromSync;
  bool continued;
} v23_syncbase_WatchChange;

// syncbase.KeyValue
typedef struct {
  v23_syncbase_String key;
  v23_syncbase_Bytes value;
} v23_syncbase_KeyValue;

// syncbase.SyncgroupSpec
typedef struct {
  v23_syncbase_String description;
  v23_syncbase_String publishSyncbaseName;
  v23_syncbase_Permissions perms;
  v23_syncbase_Ids collections;
{'fraction_non_alphanumeric': 0.11864406779661017, 'fraction_numerical': 0.038032244729226956, 'mean_word_length': 3.75811209439528, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5900517', 'n_tokens_mistral': 1807, 'n_tokens_neox': 1652, 'n_words': 365}