git/reftable/writer.c

/*
Copyright 2020 Google LLC

Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file or at
https://developers.google.com/open-source/licenses/bsd
*/

#include "writer.h"

#include "system.h"

#include "block.h"
#include "constants.h"
#include "record.h"
#include "tree.h"
#include "reftable-error.h"

/* finishes a block, and writes it to storage */
static int writer_flush_block(struct reftable_writer *w);

/* deallocates memory related to the index */
static void writer_clear_index(struct reftable_writer *w);

/* finishes writing a 'r' (refs) or 'g' (reflogs) section */
static int writer_finish_public_section(struct reftable_writer *w);

static struct reftable_block_stats *
writer_reftable_block_stats(struct reftable_writer *w, uint8_t typ)
{}

/* write data, queuing the padding for the next write. Returns negative for
 * error. */
static int padded_write(struct reftable_writer *w, uint8_t *data, size_t len,
			int padding)
{}

static void options_set_defaults(struct reftable_write_options *opts)
{}

static int writer_version(struct reftable_writer *w)
{}

static int writer_write_header(struct reftable_writer *w, uint8_t *dest)
{}

static int writer_reinit_block_writer(struct reftable_writer *w, uint8_t typ)
{}

int reftable_writer_new(struct reftable_writer **out,
			ssize_t (*writer_func)(void *, const void *, size_t),
			int (*flush_func)(void *),
			void *writer_arg, const struct reftable_write_options *_opts)
{}

void reftable_writer_set_limits(struct reftable_writer *w, uint64_t min,
				uint64_t max)
{}

static void writer_release(struct reftable_writer *w)
{}

void reftable_writer_free(struct reftable_writer *w)
{}

struct obj_index_tree_node {};

#define OBJ_INDEX_TREE_NODE_INIT

static int obj_index_tree_node_compare(const void *a, const void *b)
{}

static int writer_index_hash(struct reftable_writer *w, struct strbuf *hash)
{}

static int writer_add_record(struct reftable_writer *w,
			     struct reftable_record *rec)
{}

int reftable_writer_add_ref(struct reftable_writer *w,
			    struct reftable_ref_record *ref)
{}

int reftable_writer_add_refs(struct reftable_writer *w,
			     struct reftable_ref_record *refs, int n)
{}

static int reftable_writer_add_log_verbatim(struct reftable_writer *w,
					    struct reftable_log_record *log)
{}

int reftable_writer_add_log(struct reftable_writer *w,
			    struct reftable_log_record *log)
{}

int reftable_writer_add_logs(struct reftable_writer *w,
			     struct reftable_log_record *logs, int n)
{}

static int writer_finish_section(struct reftable_writer *w)
{}

struct common_prefix_arg {};

static void update_common(void *void_arg, void *key)
{}

struct write_record_arg {};

static void write_object_record(void *void_arg, void *key)
{}

static void object_record_free(void *void_arg UNUSED, void *key)
{}

static int writer_dump_object_index(struct reftable_writer *w)
{}

static int writer_finish_public_section(struct reftable_writer *w)
{}

int reftable_writer_close(struct reftable_writer *w)
{}

static void writer_clear_index(struct reftable_writer *w)
{}

static int writer_flush_nonempty_block(struct reftable_writer *w)
{}

static int writer_flush_block(struct reftable_writer *w)
{}

const struct reftable_stats *reftable_writer_stats(struct reftable_writer *w)
{}