diff options
Diffstat (limited to 'src/unstable/blobbuilder.h')
-rw-r--r-- | src/unstable/blobbuilder.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/unstable/blobbuilder.h b/src/unstable/blobbuilder.h index 483de43..744212a 100644 --- a/src/unstable/blobbuilder.h +++ b/src/unstable/blobbuilder.h | |||
@@ -61,6 +61,26 @@ namespace Bu | |||
61 | }; | 61 | }; |
62 | /** @endcond */ | 62 | /** @endcond */ |
63 | 63 | ||
64 | /** | ||
65 | * This makes creating a Blob piece at a time easy and fast. You can | ||
66 | * append, prepend, or insert with reasonable efficiency. The underlying | ||
67 | * data structure is currently a linked list, and the individual links are | ||
68 | * actually block allocated memory. If an amount of data is appended that | ||
69 | * is less than the minimum page size then the minimum page size is | ||
70 | * allocated. Subsequent appends will share that allocated buffer until it | ||
71 | * is full, at which point a new buffer will be created. If an amount | ||
72 | * greater than the minimum page size is appended then any extra space in | ||
73 | * the last buffer is used, and then the rest is placed in a single buffer. | ||
74 | * At most one buffer will be allocated for any given append or prepend | ||
75 | * operation. Due to the nature of insert, up to two buffers could be | ||
76 | * allocated. | ||
77 | * | ||
78 | * Insert operations will take O(N) time to find the location to insert to | ||
79 | * in the linked list, at that point the foud chunk will be split into two | ||
80 | * and the new data will be added at the new location. This will also | ||
81 | * attempt to share the existing buffers, but if there's extra it will | ||
82 | * allocate a new buffer for the remaining data. | ||
83 | */ | ||
64 | class BlobBuilder : public Bu::SharedCore<BlobBuilder, BlobBuilderCore> | 84 | class BlobBuilder : public Bu::SharedCore<BlobBuilder, BlobBuilderCore> |
65 | { | 85 | { |
66 | protected: | 86 | protected: |