Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/reftable/reftable-blocksource.h # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / reftable / reftable-blocksource.h` 53 lines ยท 1459 bytes Raw Blame History 1 /* 2 * Copyright 2020 Google LLC 3 * 4 * Use of this source code is governed by a BSD-style 5 * license that can be found in the LICENSE file or at 6 * https://developers.google.com/open-source/licenses/bsd 7 */ 8 9 #ifndef REFTABLE_BLOCKSOURCE_H 10 #define REFTABLE_BLOCKSOURCE_H 11 12 #include "reftable-system.h" 13 14 /* 15 * Generic wrapper for a seekable readable file. 16 */ 17 struct reftable_block_source { 18 struct reftable_block_source_vtable *ops; 19 void *arg; 20 }; 21 22 /* a contiguous segment of bytes. It keeps track of its generating block_source 23 * so it can return itself into the pool. */ 24 struct reftable_block_data { 25 uint8_t *data; 26 size_t len; 27 struct reftable_block_source source; 28 }; 29 30 /* block_source_vtable are the operations that make up block_source */ 31 struct reftable_block_source_vtable { 32 /* Returns the size of a block source. */ 33 uint64_t (*size)(void *source); 34 35 /* 36 * Reads a segment from the block source. It is an error to read beyond 37 * the end of the block. 38 */ 39 ssize_t (*read_data)(void *source, struct reftable_block_data *dest, 40 uint64_t off, uint32_t size); 41 42 /* Mark the block as read; may release the data. */ 43 void (*release_data)(void *source, struct reftable_block_data *data); 44 45 /* Release all resources associated with the block source. */ 46 void (*close)(void *source); 47 }; 48 49 /* opens a file on the file system as a block_source */ 50 int reftable_block_source_from_file(struct reftable_block_source *block_src, 51 const char *name); 52 53 #endif