lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [lucy-commits] [53/54] [abbrv] git commit: refs/heads/sortex_ptr_only - Update SortExternal docs with new terminology.
Date Sat, 26 Apr 2014 23:12:23 GMT
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/00181bd4
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/00181bd4
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/00181bd4

Branch: refs/heads/sortex_ptr_only
Commit: 00181bd4e0eb18c3d79f09ddbb8f8e63c08101e5
Parents: 3b0c585
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Fri Jan 11 16:13:45 2013 -0800
Committer: Marvin Humphrey <marvin@rectangular.com>
Committed: Sat Apr 26 16:01:56 2014 -0700

----------------------------------------------------------------------
 core/Lucy/Index/PostingPool.c     | 16 ++++++++--------
 core/Lucy/Index/SortFieldWriter.c |  6 +++---
 core/Lucy/Util/BBSortEx.c         |  6 +++---
 core/Lucy/Util/SortExternal.c     | 26 +++++++++++++-------------
 core/Lucy/Util/SortExternal.cfh   | 16 ++++++++--------
 5 files changed, 35 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/00181bd4/core/Lucy/Index/PostingPool.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PostingPool.c b/core/Lucy/Index/PostingPool.c
index 3088f34..fc71473 100644
--- a/core/Lucy/Index/PostingPool.c
+++ b/core/Lucy/Index/PostingPool.c
@@ -277,7 +277,7 @@ PostPool_Flush_IMP(PostingPool *self) {
                                             ivars->segment, ivars->polyreader,
                                             ivars->post_temp_out);
 
-    // Borrow the cache.
+    // Borrow the buffer.
     run_ivars->buffer   = ivars->buffer;
     run_ivars->buf_tick = ivars->buf_tick;
     run_ivars->buf_max  = ivars->buf_max;
@@ -295,7 +295,7 @@ PostPool_Flush_IMP(PostingPool *self) {
     run_ivars->post_end = OutStream_Tell(ivars->post_temp_out);
     LexWriter_Leave_Temp_Mode(ivars->lex_writer);
 
-    // Return the cache and empty it.
+    // Return the buffer and empty it.
     run_ivars->buffer   = NULL;
     run_ivars->buf_tick = 0;
     run_ivars->buf_max  = 0;
@@ -458,9 +458,9 @@ PostPool_Refill_IMP(PostingPool *self) {
     if (ivars->lexicon == NULL) { return 0; }
     else { term_text = (String*)Lex_Get_Term(lexicon); }
 
-    // Make sure cache is empty.
+    // Make sure buffer is empty.
     if (ivars->buf_max - ivars->buf_tick > 0) {
-        THROW(ERR, "Refill called but cache contains %u32 items",
+        THROW(ERR, "Refill called but buffer contains %u32 items",
               ivars->buf_max - ivars->buf_tick);
     }
     ivars->buf_max  = 0;
@@ -492,7 +492,7 @@ PostPool_Refill_IMP(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_ivars->consumed >= mem_thresh && num_elems > 0) {
             break;
         }
@@ -514,7 +514,7 @@ PostPool_Refill_IMP(PostingPool *self) {
             rawpost_ivars->doc_id = remapped;
         }
 
-        // Add to the run's cache.
+        // Add to the run's buffer.
         if (num_elems >= ivars->buf_cap) {
             size_t new_cap = Memory_oversize(num_elems + 1, sizeof(Obj*));
             PostPool_Grow_Buffer(self, new_cap);
@@ -523,7 +523,7 @@ PostPool_Refill_IMP(PostingPool *self) {
         num_elems++;
     }
 
-    // Reset the cache array position and length; remember file pos.
+    // Reset the buffer array position and length; remember file pos.
     ivars->buf_max   = num_elems;
     ivars->buf_tick  = 0;
 
@@ -546,7 +546,7 @@ S_fresh_flip(PostingPool *self, InStream *lex_temp_in,
     if (ivars->flipped) { THROW(ERR, "Can't Flip twice"); }
     ivars->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/00181bd4/core/Lucy/Index/SortFieldWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.c b/core/Lucy/Index/SortFieldWriter.c
index 9cdf47a..381f9ad 100644
--- a/core/Lucy/Index/SortFieldWriter.c
+++ b/core/Lucy/Index/SortFieldWriter.c
@@ -144,7 +144,7 @@ SortFieldWriter_Clear_Buffer_IMP(SortFieldWriter *self) {
     // This is because the pool is shared amongst multiple SortFieldWriters
     // which belong to a parent SortWriter; it is the responsibility of the
     // parent SortWriter to release the memory pool once **all** of its child
-    // SortFieldWriters have cleared their caches.
+    // SortFieldWriters have cleared their buffers.
 }
 
 void
@@ -433,10 +433,10 @@ SortFieldWriter_Refill_IMP(SortFieldWriter *self) {
     SortFieldWriterIVARS *const ivars = SortFieldWriter_IVARS(self);
     if (!ivars->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",
+        THROW(ERR, "Refill called but buffer contains %u32 items",
               buf_count);
     }
     SortFieldWriter_Clear_Buffer(self);

http://git-wip-us.apache.org/repos/asf/lucy/blob/00181bd4/core/Lucy/Util/BBSortEx.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/BBSortEx.c b/core/Lucy/Util/BBSortEx.c
index 662a570..ff96c73 100644
--- a/core/Lucy/Util/BBSortEx.c
+++ b/core/Lucy/Util/BBSortEx.c
@@ -92,7 +92,7 @@ BBSortEx_Flush_IMP(BBSortEx *self) {
     DECREF(elems);
     BBSortEx_Add_Run(self, (SortExternal*)run);
 
-    // Blank the cache vars.
+    // Blank the buffer vars.
     ivars->buf_tick += buf_count;
     BBSortEx_Clear_Buffer(self);
 }
@@ -101,9 +101,9 @@ uint32_t
 BBSortEx_Refill_IMP(BBSortEx *self) {
     BBSortExIVARS *const ivars = BBSortEx_IVARS(self);
 
-    // Make sure cache is empty, then set cache tick vars.
+    // Make sure buffer is empty, then set buffer tick vars.
     if (ivars->buf_max - ivars->buf_tick > 0) {
-        THROW(ERR, "Refill called but cache contains %u32 items",
+        THROW(ERR, "Refill called but buffer contains %u32 items",
               ivars->buf_max - ivars->buf_tick);
     }
     ivars->buf_tick = 0;

http://git-wip-us.apache.org/repos/asf/lucy/blob/00181bd4/core/Lucy/Util/SortExternal.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/SortExternal.c b/core/Lucy/Util/SortExternal.c
index c7dff90..c8b6963 100644
--- a/core/Lucy/Util/SortExternal.c
+++ b/core/Lucy/Util/SortExternal.c
@@ -19,19 +19,19 @@
 
 #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_buffer(SortExternal *self, SortExternalIVARS *ivars);
 
 // Absorb all the items which are "in-range" from all the Runs into the main
-// cache.
+// buffer.
 static void
 S_absorb_slices(SortExternal *self, SortExternalIVARS *ivars,
                 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, SortExternalIVARS *ivars);
 
@@ -199,10 +199,10 @@ SortEx_Shrink_IMP(SortExternal *self) {
 
 static void
 S_refill_buffer(SortExternal *self, SortExternalIVARS *ivars) {
-    // Reset cache vars.
+    // 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(ivars->runs)) {
         SortExternal *const run = (SortExternal*)VA_Fetch(ivars->runs, i);
@@ -214,7 +214,7 @@ S_refill_buffer(SortExternal *self, SortExternalIVARS *ivars) {
         }
     }
 
-    // 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(ivars->runs)) {
         Obj **endpost = S_find_endpost(self, ivars);
         S_absorb_slices(self, ivars, endpost);
@@ -226,12 +226,12 @@ S_find_endpost(SortExternal *self, SortExternalIVARS *ivars) {
     Obj **endpost = NULL;
 
     for (uint32_t i = 0, max = VA_Get_Size(ivars->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(ivars->runs, i);
         SortExternalIVARS *const run_ivars = SortEx_IVARS(run);
         const uint32_t tick = run_ivars->buf_max - 1;
         if (tick >= run_ivars->buf_cap || run_ivars->buf_max < 1) {
-            THROW(ERR, "Invalid SortExternal cache access: %u32 %u32 %u32", tick,
+            THROW(ERR, "Invalid SortExternal buffer access: %u32 %u32 %u32", tick,
                   run_ivars->buf_max, run_ivars->buf_cap);
         }
         else {
@@ -265,14 +265,14 @@ S_absorb_slices(SortExternal *self, SortExternalIVARS *ivars,
 
     if (ivars->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(ivars->runs, i);
         SortExternalIVARS *const run_ivars = SortEx_IVARS(run);
         uint32_t slice_size = S_find_slice_size(run, run_ivars, endpost);
 
         if (slice_size) {
-            // Move slice content from run cache to main cache.
+            // Move slice content from run buffer to main buffer.
             if (ivars->buf_max + slice_size > ivars->buf_cap) {
                 size_t cap = Memory_oversize(ivars->buf_max + slice_size,
                                              sizeof(Obj*));
@@ -296,7 +296,7 @@ S_absorb_slices(SortExternal *self, SortExternalIVARS *ivars,
         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 (ivars->scratch_cap < ivars->buf_cap) {
         ivars->scratch_cap = ivars->buf_cap;
@@ -304,7 +304,7 @@ S_absorb_slices(SortExternal *self, SortExternalIVARS *ivars,
                             ivars->scratch, ivars->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 (ivars->num_slices > 1) {
         uint32_t i = 0;

http://git-wip-us.apache.org/repos/asf/lucy/blob/00181bd4/core/Lucy/Util/SortExternal.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/SortExternal.cfh b/core/Lucy/Util/SortExternal.cfh
index 917f5df..5ffb44c 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 sort 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 nickname SortEx
     abstract int
     Compare(SortExternal *self, void *va, void *vb);
 
-    /** Flush all elements currently in the cache.
+    /** Flush all elements currently in the buffer.
      *
      * Presumably this entails sorting everything, writing the sorted elements
      * to disk, spawning a child object to represent those elements, and
@@ -100,31 +100,31 @@ abstract class Lucy::Util::SortExternal nickname 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 more memory to the buffer.
      */
     void
     Grow_Buffer(SortExternal *self, uint32_t cap);


Mime
View raw message