~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/delta.h

  • Committer: Vincent Ladeuil
  • Date: 2011-05-26 20:30:53 UTC
  • mfrom: (5920 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5924.
  • Revision ID: v.ladeuil+lp@free.fr-20110526203053-hbjn6yuzwg03wnuv
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
                                 aggregate source */
22
22
};
23
23
 
24
 
 
25
24
/* result type for functions that have multiple failure modes */
26
25
typedef enum {
27
26
    DELTA_OK,             /* Success */
42
41
 * free_delta_index().  Other values are a failure, and *fresh is unset.
43
42
 * The given buffer must not be freed nor altered before free_delta_index() is
44
43
 * called. The resultant struct must be freed using free_delta_index().
 
44
 *
 
45
 * :param max_bytes_to_index: Limit the number of regions to sample to this
 
46
 *      amount of text. We will store at most max_bytes_to_index / RABIN_WINDOW
 
47
 *      pointers into the source text.  Useful if src can be unbounded in size,
 
48
 *      and you are willing to trade match accuracy for peak memory.
45
49
 */
46
50
extern delta_result
47
51
create_delta_index(const struct source_info *src,
48
52
                   struct delta_index *old,
49
 
                   struct delta_index **fresh);
 
53
                   struct delta_index **fresh,
 
54
                   int max_bytes_to_index);
50
55
 
51
56
 
52
57
/*
118
123
    return size;
119
124
}
120
125
 
 
126
/*
 
127
 * Return the basic information about a given delta index.
 
128
 * :param index: The delta_index object
 
129
 * :param pos: The offset in the entry list. Start at 0, and walk until you get
 
130
 *      0 as a return code.
 
131
 * :param global_offset: return value, distance to the beginning of all sources
 
132
 * :param hash_val: return value, the RABIN hash associated with this pointer
 
133
 * :param hash_offset: Location for this entry in the hash array.
 
134
 * :return: 1 if pos != -1 (there was data produced)
 
135
 */
 
136
extern int
 
137
get_entry_summary(const struct delta_index *index, int pos,
 
138
                  unsigned int *text_offset, unsigned int *hash_val);
 
139
 
 
140
/*
 
141
 * Determine what entry index->hash[X] points to.
 
142
 */
 
143
extern int
 
144
get_hash_offset(const struct delta_index *index, int pos,
 
145
                unsigned int *entry_offset);
 
146
 
 
147
/*
 
148
 * Compute the rabin_hash of the given data, it is assumed the data is at least
 
149
 * RABIN_WINDOW wide (16 bytes).
 
150
 */
 
151
extern unsigned int
 
152
rabin_hash(const unsigned char *data);
 
153
 
121
154
#endif