git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob c92a178773db54a8a191da07f0c9ad6d6382afb0 1984 bytes (raw)
name: reftable/iter.h 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
 
/*
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
*/

#ifndef ITER_H
#define ITER_H

#include "block.h"
#include "record.h"
#include "strbuf.h"

struct reftable_iterator_vtable {
	int (*next)(void *iter_arg, struct reftable_record *rec);
	void (*close)(void *iter_arg);
};

void iterator_set_empty(struct reftable_iterator *it);
int iterator_next(struct reftable_iterator *it, struct reftable_record *rec);

/* Returns true for a zeroed out iterator, such as the one returned from
   iterator_destroy. */
int iterator_is_null(struct reftable_iterator *it);

/* iterator that produces only ref records that point to `oid` */
struct filtering_ref_iterator {
	int double_check;
	struct reftable_table tab;
	struct strbuf oid;
	struct reftable_iterator it;
};
#define FILTERING_REF_ITERATOR_INIT \
	{                           \
		.oid = STRBUF_INIT  \
	}

void iterator_from_filtering_ref_iterator(struct reftable_iterator *,
					  struct filtering_ref_iterator *);

/* iterator that produces only ref records that point to `oid`,
   but using the object index.
 */
struct indexed_table_ref_iter {
	struct reftable_reader *r;
	struct strbuf oid;

	/* mutable */
	uint64_t *offsets;

	/* Points to the next offset to read. */
	int offset_idx;
	int offset_len;
	struct block_reader block_reader;
	struct block_iter cur;
	int is_finished;
};

#define INDEXED_TABLE_REF_ITER_INIT                                     \
	{                                                               \
		.cur = { .last_key = STRBUF_INIT }, .oid = STRBUF_INIT, \
	}

void iterator_from_indexed_table_ref_iter(struct reftable_iterator *it,
					  struct indexed_table_ref_iter *itr);
int new_indexed_table_ref_iter(struct indexed_table_ref_iter **dest,
			       struct reftable_reader *r, uint8_t *oid,
			       int oid_len, uint64_t *offsets, int offset_len);

#endif

debug log:

solving c92a178773 ...
found c92a178773 in https://public-inbox.org/git/25259b683bc35b4f6741c1b2b07b41b99019c088.1600283416.git.gitgitgadget@gmail.com/ ||
	https://public-inbox.org/git/c196de7f0639f42133cf520c0e04db8a23c7e8ce.1601568664.git.gitgitgadget@gmail.com/

applying [1/1] https://public-inbox.org/git/25259b683bc35b4f6741c1b2b07b41b99019c088.1600283416.git.gitgitgadget@gmail.com/
diff --git a/reftable/iter.h b/reftable/iter.h
new file mode 100644
index 0000000000..c92a178773

Checking patch reftable/iter.h...
Applied patch reftable/iter.h cleanly.

skipping https://public-inbox.org/git/c196de7f0639f42133cf520c0e04db8a23c7e8ce.1601568664.git.gitgitgadget@gmail.com/ for c92a178773
index at:
100644 c92a178773db54a8a191da07f0c9ad6d6382afb0	reftable/iter.h

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).