return lowestOffset ();
}
-int
-mem_hdr::appendToNode(mem_node *aNode, const char *data, int maxLength)
-{
- size_t result = writeAvailable (aNode, aNode->nodeBuffer.offset + aNode->nodeBuffer.length,maxLength, data);
- return result;
-}
-
size_t
mem_hdr::writeAvailable(mem_node *aNode, int64_t location, size_t amount, char const *source)
{
nodes.insert (aNode, NodeCompare);
}
-void
-mem_hdr::makeAppendSpace()
-{
- if (!nodes.size()) {
- appendNode (new mem_node (0));
- return;
- }
-
- if (!nodes.finish()->data->space())
- appendNode (new mem_node (endOffset()));
-
- assert (nodes.finish()->data->space());
-}
-
-void
-mem_hdr::internalAppend(const char *data, int len)
-{
- debugs(19, 6, "memInternalAppend: " << this << " len " << len);
-
- while (len > 0) {
- makeAppendSpace();
- int copied = appendToNode (nodes.finish()->data, data, len);
- assert (copied);
-
- len -= copied;
- data += copied;
- }
-}
-
/* returns a mem_node that contains location..
* If no node contains the start, it returns NULL.
*/
return nodes.size();
}
-mem_node const *
-mem_hdr::start() const
-{
- const SplayNode<mem_node *> * result = nodes.start();
-
- if (result)
- return result->data;
-
- return nullptr;
-}
-
const Splay<mem_node *> &
mem_hdr::getNodes() const
{
bool write (StoreIOBuffer const &);
void dump() const;
size_t size() const;
- /* Not an iterator - thus the start, not begin() */
- mem_node const *start() const;
mem_node *getBlockContainingLocation (int64_t location) const;
/* access the contained nodes - easier than punning
* as a container ourselves
const Splay<mem_node *> &getNodes() const;
char * NodeGet(mem_node * aNode);
- /* Only for use of MemObject */
- void internalAppend(const char *data, int len);
-
static Splay<mem_node *>::SPLAYCMP NodeCompare;
private:
void debugDump() const;
bool unlink(mem_node *aNode);
- void makeAppendSpace();
- int appendToNode(mem_node *aNode, const char *data, int maxLength);
void appendNode (mem_node *aNode);
size_t copyAvailable(mem_node *aNode, int64_t location, size_t amount, char *target) const;
bool unionNotEmpty (StoreIOBuffer const &);