lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [lucy-commits] [3/3] git commit: refs/heads/sortex_ptr_only - Update SortExternal docs with new terminology.
Date Thu, 17 Jan 2013 23:15:48 GMT
Updated Branches:
  refs/heads/sortex_ptr_only 22d40ec05 -> ad8f92cf4


Update SortExternal docs with new terminology.

Modify comments and docs to use "buffer" instead of "cache".


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/ad8f92cf
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/ad8f92cf
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/ad8f92cf

Branch: refs/heads/sortex_ptr_only
Commit: ad8f92cf445477f22d5bea749f3d15d9199929ff
Parents: 06ab08d
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Fri Jan 11 16:13:45 2013 -0800
Committer: Marvin Humphrey <marvin@rectangular.com>
Committed: Fri Jan 11 16:13:45 2013 -0800

----------------------------------------------------------------------
 core/Lucy/Index/PostingPool.c     |   16 ++++++------
 core/Lucy/Index/SortFieldWriter.c |    2 +-
 core/Lucy/Test/Util/BBSortEx.c    |    6 ++--
 core/Lucy/Util/SortExternal.c     |   38 ++++++++++++++++----------------
 core/Lucy/Util/SortExternal.cfh   |   18 +++++++-------
 5 files changed, 40 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/ad8f92cf/core/Lucy/Index/PostingPool.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PostingPool.c b/core/Lucy/Index/PostingPool.c
index b01ef00..30ef58d 100644
--- a/core/Lucy/Index/PostingPool.c
+++ b/core/Lucy/Index/PostingPool.c
@@ -266,7 +266,7 @@ PostPool_flush(PostingPool *self) {
                                             self->segment, self->polyreader,
                                             self->post_temp_out);
 
-    // Borrow the cache.
+    // Borrow the buffer.
     run->buffer   = self->buffer;
     run->buf_tick = self->buf_tick;
     run->buf_max  = self->buf_max;
@@ -284,7 +284,7 @@ PostPool_flush(PostingPool *self) {
     run->post_end = OutStream_Tell(self->post_temp_out);
     LexWriter_Leave_Temp_Mode(self->lex_writer);
 
-    // Return the cache and empty it.
+    // Return the buffer and empty it.
     run->buffer   = NULL;
     run->buf_tick = 0;
     run->buf_max  = 0;
@@ -436,9 +436,9 @@ PostPool_refill(PostingPool *self) {
     if (self->lexicon == NULL) { return 0; }
     else { term_text = (CharBuf*)Lex_Get_Term(lexicon); }
 
-    // Make sure cache is empty.
+    // Make sure buffer is empty.
     if (self->buf_max - self->buf_tick > 0) {
-        THROW(ERR, "Refill called but cache contains %u32 items",
+        THROW(ERR, "Refill called but buffer contains %u32 items",
               self->buf_max - self->buf_tick);
     }
     self->buf_max  = 0;
@@ -470,7 +470,7 @@ PostPool_refill(PostingPool *self) {
             }
         }
 
-        // Bail if we've hit the ceiling for this run's cache.
+        // Bail if we've hit the ceiling for this run's buffer.
         if (mem_pool->consumed >= mem_thresh && num_elems > 0) {
             break;
         }
@@ -491,7 +491,7 @@ PostPool_refill(PostingPool *self) {
             raw_posting->doc_id = remapped;
         }
 
-        // Add to the run's cache.
+        // Add to the run's buffer.
         if (num_elems >= self->buf_cap) {
             size_t new_cap = Memory_oversize(num_elems + 1, sizeof(Obj*));
             PostPool_Grow_Buffer(self, new_cap);
@@ -500,7 +500,7 @@ PostPool_refill(PostingPool *self) {
         num_elems++;
     }
 
-    // Reset the cache array position and length; remember file pos.
+    // Reset the buffer array position and length; remember file pos.
     self->buf_max  = num_elems;
     self->buf_tick = 0;
 
@@ -520,7 +520,7 @@ S_fresh_flip(PostingPool *self, InStream *lex_temp_in,
     if (self->flipped) { THROW(ERR, "Can't Flip twice"); }
     self->flipped = true;
 
-    // Sort RawPostings in cache, if any.
+    // Sort RawPostings in buffer, if any.
     PostPool_Sort_Buffer(self);
 
     // Bail if never flushed.

http://git-wip-us.apache.org/repos/asf/lucy/blob/ad8f92cf/core/Lucy/Index/SortFieldWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.c b/core/Lucy/Index/SortFieldWriter.c
index f780e83..2989b7e 100644
--- a/core/Lucy/Index/SortFieldWriter.c
+++ b/core/Lucy/Index/SortFieldWriter.c
@@ -414,7 +414,7 @@ uint32_t
 SortFieldWriter_refill(SortFieldWriter *self) {
     if (!self->sort_cache) { return 0; }
 
-    // Sanity check, then reset the cache and prepare to start loading items.
+    // Sanity check, then reset the buffer and prepare to start loading items.
     uint32_t buf_count = SortFieldWriter_Buffer_Count(self);
     if (buf_count) {
         THROW(ERR, "Refill called but cache contains %u32 items",

http://git-wip-us.apache.org/repos/asf/lucy/blob/ad8f92cf/core/Lucy/Test/Util/BBSortEx.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/BBSortEx.c b/core/Lucy/Test/Util/BBSortEx.c
index 943b7f1..42045b6 100644
--- a/core/Lucy/Test/Util/BBSortEx.c
+++ b/core/Lucy/Test/Util/BBSortEx.c
@@ -86,16 +86,16 @@ BBSortEx_flush(BBSortEx *self) {
     DECREF(elems);
     BBSortEx_Add_Run(self, (SortExternal*)run);
 
-    // Blank the cache vars.
+    // Blank the buffer vars.
     self->buf_tick += buf_count;
     BBSortEx_Clear_Buffer(self);
 }
 
 uint32_t
 BBSortEx_refill(BBSortEx *self) {
-    // Make sure cache is empty, then set cache tick vars.
+    // Make sure buffer is empty, then set buffer tick vars.
     if (self->buf_max - self->buf_tick > 0) {
-        THROW(ERR, "Refill called but cache contains %u32 items",
+        THROW(ERR, "Refill called but buffer contains %u32 items",
               self->buf_max - self->buf_tick);
     }
     self->buf_tick = 0;

http://git-wip-us.apache.org/repos/asf/lucy/blob/ad8f92cf/core/Lucy/Util/SortExternal.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/SortExternal.c b/core/Lucy/Util/SortExternal.c
index 37eba61..4c08556 100644
--- a/core/Lucy/Util/SortExternal.c
+++ b/core/Lucy/Util/SortExternal.c
@@ -19,18 +19,18 @@
 
 #include "Lucy/Util/SortExternal.h"
 
-// Refill the main cache, drawing from the caches of all runs.
+// Refill the main buffer, drawing from the buffers of all runs.
 static void
-S_refill_cache(SortExternal *self);
+S_refill_buffer(SortExternal *self);
 
 // Absorb all the items which are "in-range" from all the Runs into the main
-// cache.
+// buffer.
 static void
 S_absorb_slices(SortExternal *self, Obj **endpost);
 
-// Return the address for the item in one of the runs' caches which is the
+// Return the address for the item in one of the runs' buffers which is the
 // highest in sort order, but which we can guarantee is lower in sort order
-// than any item which has yet to enter a run cache.
+// than any item which has yet to enter a run buffer.
 static Obj**
 S_find_endpost(SortExternal *self);
 
@@ -93,7 +93,7 @@ SortEx_feed(SortExternal *self, Obj *item) {
 static INLINE Obj*
 SI_peek(SortExternal *self) {
     if (self->buf_tick >= self->buf_max) {
-        S_refill_cache(self);
+        S_refill_buffer(self);
     }
 
     if (self->buf_max > 0) {
@@ -186,11 +186,11 @@ SortEx_shrink(SortExternal *self) {
 }
 
 static void
-S_refill_cache(SortExternal *self) {
-    // Reset cache vars.
+S_refill_buffer(SortExternal *self) {
+    // Reset buffer vars.
     SortEx_Clear_Buffer(self);
 
-    // Make sure all runs have at least one item in the cache.
+    // Make sure all runs have at least one item in the buffer.
     uint32_t i = 0;
     while (i < VA_Get_Size(self->runs)) {
         SortExternal *const run = (SortExternal*)VA_Fetch(self->runs, i);
@@ -202,7 +202,7 @@ S_refill_cache(SortExternal *self) {
         }
     }
 
-    // Absorb as many elems as possible from all runs into main cache.
+    // Absorb as many elems as possible from all runs into main buffer.
     if (VA_Get_Size(self->runs)) {
         Obj **endpost = S_find_endpost(self);
         S_absorb_slices(self, endpost);
@@ -214,16 +214,16 @@ S_find_endpost(SortExternal *self) {
     Obj **endpost = NULL;
 
     for (uint32_t i = 0, max = VA_Get_Size(self->runs); i < max; i++) {
-        // Get a run and retrieve the last item in its cache.
+        // Get a run and retrieve the last item in its buffer.
         SortExternal *const run = (SortExternal*)VA_Fetch(self->runs, i);
         const uint32_t tick = run->buf_max - 1;
         if (tick >= run->buf_cap || run->buf_max < 1) {
-            THROW(ERR, "Invalid SortExternal cache access: %u32 %u32 %u32", tick,
-                  run->buf_max, run->buf_cap);
+            THROW(ERR, "Invalid SortExternal buffer access: %u32 %u32 %u32",
+                  tick, run->buf_max, run->buf_cap);
         }
         else {
-            // Cache item with the highest sort value currently held in memory
-            // by the run.
+            // Buffer item with the highest sort value currently held in
+            // memory by the run.
             Obj **candidate = run->buffer + tick;
 
             // If it's the first run, item is automatically the new endpost.
@@ -251,13 +251,13 @@ S_absorb_slices(SortExternal *self, Obj **endpost) {
 
     if (self->buf_max != 0) { THROW(ERR, "Can't refill unless empty"); }
 
-    // Move all the elements in range into the main cache as slices.
+    // Move all the elements in range into the main buffer as slices.
     for (uint32_t i = 0; i < num_runs; i++) {
         SortExternal *const run = (SortExternal*)VA_Fetch(self->runs, i);
         uint32_t slice_size = S_find_slice_size(run, endpost);
 
         if (slice_size) {
-            // Move slice content from run cache to main cache.
+            // Move slice content from run buffer to main buffer.
             if (self->buf_max + slice_size > self->buf_cap) {
                 size_t cap = Memory_oversize(self->buf_max + slice_size,
                                              sizeof(Obj*));
@@ -281,7 +281,7 @@ S_absorb_slices(SortExternal *self, Obj **endpost) {
         total += slice_sizes[i];
     }
 
-    // The main cache now consists of several slices.  Sort the main cache,
+    // The main buffer now consists of several slices.  Sort the main buffer,
     // but exploit the fact that each slice is already sorted.
     if (self->scratch_cap < self->buf_cap) {
         self->scratch_cap = self->buf_cap;
@@ -289,7 +289,7 @@ S_absorb_slices(SortExternal *self, Obj **endpost) {
                             self->scratch, self->scratch_cap * sizeof(Obj*));
     }
 
-    // Exploit previous sorting, rather than sort cache naively.
+    // Exploit previous sorting, rather than sort buffer naively.
     // Leave the first slice intact if the number of slices is odd. */
     while (self->num_slices > 1) {
         uint32_t i = 0;

http://git-wip-us.apache.org/repos/asf/lucy/blob/ad8f92cf/core/Lucy/Util/SortExternal.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/SortExternal.cfh b/core/Lucy/Util/SortExternal.cfh
index 988f61a..98588d5 100644
--- a/core/Lucy/Util/SortExternal.cfh
+++ b/core/Lucy/Util/SortExternal.cfh
@@ -26,7 +26,7 @@ parcel Lucy;
  * It's expected that the total memory footprint of the sortable objects will
  * eventually exceed a specified threshold; at that point, the SortExternal
  * object will call the abstract method Flush().  It's expected that Flush()
- * implementations will empty out the current sort cache, write a sorted "run"
+ * implementations will empty out the current buffer, write a sorted "run"
  * to external storage, and add a new child SortExternal object to the top
  * level object's "runs" array to represent the flushed content.
  *
@@ -59,7 +59,7 @@ abstract class Lucy::Util::SortExternal cnick SortEx
     abstract int
     Compare(SortExternal *self, void *va, void *vb);
 
-    /** Flush all elements currently in the cache.
+    /** Flush all buffered elements.
      *
      * Presumably this entails sorting everything, writing the sorted elements
      * to disk, spawning a child object to represent those elements, and
@@ -100,34 +100,34 @@ abstract class Lucy::Util::SortExternal cnick SortEx
     void
     Shrink(SortExternal *self);
 
-    /** Refill the cache of a run.  Will only be called on child objects, not
+    /** Refill the buffer of a run.  Will only be called on child objects, not
      * the main object.
      */
     abstract uint32_t
     Refill(SortExternal *self);
 
-    /** Sort all items currently in the main cache.
+    /** Sort all items currently in the main buffer.
      */
     void
     Sort_Buffer(SortExternal *self);
 
-    /** Reset cache variables so that cache gives the appearance of having
+    /** Reset buffer variables so that buffer gives the appearance of having
      * been initialized.
      *
-     * Subclasses may take steps to release items held in cache, if any.
+     * Subclasses may take steps to release items held in buffer, if any.
      */
     void
     Clear_Buffer(SortExternal *self);
 
-    /** Return the number of items presently in the cache.
+    /** Return the number of items presently in the buffer.
      */
     uint32_t
     Buffer_Count(SortExternal *self);
 
-    /** Allocate more memory to the cache.
+    /** Allocate enough memory to accommodate `count` elements in the buffer.
      */
     void
-    Grow_Buffer(SortExternal *self, uint32_t new_cache_cap);
+    Grow_Buffer(SortExternal *self, uint32_t count);
 
     void
     Set_Mem_Thresh(SortExternal *self, uint32_t mem_thresh);


Mime
View raw message