Commit Graph

41057 Commits

Author SHA1 Message Date
Ingo Weinhold
ab6a1e0f74 QueryParser: The last_modified index is time_t
* Changed value type from B_INT64_TYPE to B_INT32_TYPE.
* Changed QueryPolicy::NodeGetLastModifiedTime() return value from
  bigtime_t to time_t.
2011-11-25 06:19:20 +01:00
Ingo Weinhold
3793289c21 Add size index support
* Add class SizeIndex.
* Create and add an instance of it in Volume mount.
2011-11-25 06:19:19 +01:00
Ingo Weinhold
0d988526bc GenericIndexIterator: Add node change helpers
Add NodeChangeBegin()/NodeChangeEnd() methods that can be used by the
index when the respective node attribute has changed. They make sure
that the iterator doesn't move with the node, should it be inserted into
the index at a different position.
2011-11-25 06:19:19 +01:00
Ingo Weinhold
304eaea680 Add comment 2011-11-25 06:19:18 +01:00
Ingo Weinhold
84989de15b GenericIndexIterator::SetTo(): Find fuzzily
Use TwoKeyAVLTree::FindFirstClosest() instead of FindFirst(), so, if the
value isn't in the index, we find the closest greater value. That's the
semantics Index::InternalFind() is expected to have.
2011-11-25 06:19:17 +01:00
Ingo Weinhold
abaf82e5a9 GenericIndexIterator: Fix NameIndex dependency
Next() was still copying the name. Add a GetNodeValue() method to the
policy that fetches the value instead.
2011-11-25 06:19:17 +01:00
Ingo Weinhold
f4bb0389e8 TwoKeyAVLTree: Add FindFirstClosest() 2011-11-25 06:19:16 +01:00
Ingo Weinhold
e88759a518 Small cleanup 2011-11-25 06:19:16 +01:00
Ingo Weinhold
24c2d0cc09 Refactor NameIndexIterator into template class
Create template class GenericIndexIterator from NameIndexIterator.
2011-11-25 06:19:15 +01:00
Ingo Weinhold
182e58f709 NodeListener::NodeChanged(): Provide old value
* Add interface OldNodeAttributes an instance of which is passed to
  NodeListener::NodeChanged() to provide the old attribute values
  (currently only modification time and file size).
* Also extend PackageLinksListener::PackageLinkNodeChanged() with a
  OldNodeAttributes parameter.
* Add OldNodeAttributes implementations for PackageLinkSymlink (inner
  class OldAttributes) and UnpackingNode (OldUnpackageNodeAttributes).
2011-11-25 06:19:15 +01:00
Ingo Weinhold
ac490e3bb9 PackageLinkSymlink: Init fLinkPath in constructor 2011-11-25 06:19:14 +01:00
Ingo Weinhold
670b0d106a ~NameIndex(): Make more robust
Remove the listener only, if it was registered.
2011-11-25 06:19:13 +01:00
Ingo Weinhold
8373bcd169 Name::Index(): Fix initialization order
Add the node listener directly after calling the base class Init().
Otherwise, on error, the we could try to remove the listener although it
wasn't added in the first place.
2011-11-25 06:19:13 +01:00
Ingo Weinhold
989addc209 Simplify [Abstract]IndexIterator interface
* Remove Current() and Previous() and add a HasNext() instead.
* Reimplement NameIndexIterator. It directly works with tree nodes
  instead of using an iterator, now.
2011-11-25 06:19:12 +01:00
Ingo Weinhold
dcc6ab5408 Fix NameIndexPrimaryKeyCompare
It was actually returning whether the names where not equal.
2011-11-25 06:19:12 +01:00
Ingo Weinhold
502a5e2388 QueryParser: Explicitly suspend/resume iterators
Extended policy by IndexIteratorSuspend() and IndexIteratorResume()
methods that are invoked for the index iterator by Query::GetNextEntry()
after entering respectively before exiting.
2011-11-25 06:19:11 +01:00
Ingo Weinhold
004b3604a0 AVLTreeMap/TwoKeyAVLTree: More access to nodes
both:
* Add Previous()/Next().
* Add Insert() version that returns a Node* instead of an Iterator.
* Add Remove() version that takes a Node* instead of a key.

TwoKeyAVLTree:
* Add GetIterator() version that takes an additional Node*, i.e.
  initializing an iterator to point to the node.
* Add Iterator::CurrentNode().
2011-11-25 06:19:10 +01:00
Ingo Weinhold
e7346707c9 AVLTree: Add Previous()/Next() 2011-11-25 06:19:10 +01:00
Ingo Weinhold
5deb28d6d2 Cleanup 2011-11-25 06:19:09 +01:00
Ingo Weinhold
b4a9359d84 Automatic whitespace cleanup 2011-11-25 06:19:09 +01:00
Ingo Weinhold
1fb71f8739 Implement query FS hooks, add empty index FS hooks 2011-11-25 06:19:08 +01:00
Ingo Weinhold
617ac41c60 Add Query class and query management in Volume 2011-11-25 06:19:08 +01:00
Ingo Weinhold
331b89b3a5 Add NameIndex class and create instance in Volume 2011-11-25 06:19:07 +01:00
Ingo Weinhold
4791f5ebb3 Add Index base class and index table in Volume 2011-11-25 06:19:06 +01:00
Ingo Weinhold
ec59ac7515 Add a global node listener mechanism 2011-11-25 06:19:06 +01:00
Ingo Weinhold
856c114ca0 Add TwoKeyAVLTree to kernel utils
This is a tree implementation with elements with primary and secondary
key. The code is a cleaned up version of ramfs's implementation. ramfs
doesn't use this version yet.
2011-11-25 06:19:05 +01:00
Ingo Weinhold
9d698c4573 Create a generalized version of BFS's query code
The new version is templatized over a QueryPolicy which provides the
interface to the file system specifics.
2011-11-25 06:19:05 +01:00
Ingo Weinhold
239ce182ab Fix loading the resolvable compatible version 2011-11-25 06:19:04 +01:00
Ingo Weinhold
7e0f4e5703 Fix Dependency version comparisons 2011-11-25 06:19:04 +01:00
Ingo Weinhold
e7c648e06d PackageWriterImpl::_AddEntry(): Fix update logic
* Don't only look up the entry attribute when the entry is implicit.
  Look it up, when it is a directory instead. This aligns it the logic
  with _UpdateCheckEntryCollisions().
* When the entry attribute exits and the entry is not implicit, add file
  attributes, but not stat data. This also aligns the logic with
  _UpdateCheckEntryCollisions(), which removes colliding attributes, but
  keeps stat data.
2011-11-25 06:19:03 +01:00
Ingo Weinhold
420a5c3e42 Remove copy'n'paste left-over 2011-11-25 06:19:02 +01:00
Ingo Weinhold
4d63965914 Fix "package add" heap compacting
PackageWriterImpl::_CompactHeap(): Incorrectly used fHeapEnd instead of
the heap size. So the last copied chunk was too large.
2011-11-25 06:19:02 +01:00
Ingo Weinhold
f4417e14fa PackageWriterImpl::_MoveHeapChunk(): better output 2011-11-25 06:19:01 +01:00
Ingo Weinhold
8ffba2a6cb Write uncompressed package file TOC, if necessary 2011-11-25 06:19:00 +01:00
Ingo Weinhold
2fac6eaa60 Add "package add" command. 2011-11-25 06:19:00 +01:00
Ingo Weinhold
723336fe52 Move directory iteration helper to own file 2011-11-25 06:18:59 +01:00
Ingo Weinhold
cba1e22376 Move PackageWriterListener to separate file 2011-11-25 06:18:59 +01:00
Ingo Weinhold
00bc8e9cbd Add support for adding/updating package entries
Add flags parameter to BPackageWriter::Init() (and the private
implementation classes) to indicate that an existing package file shall
be updated instead of created. Currently that always happens in-place.
2011-11-25 06:18:58 +01:00
Ingo Weinhold
de9e64b235 Write uncompressed package attributes if necessary
When compression doesn't save space, using it nonetheless results in a
file that the reader complains about. So we fall back to writing an
uncompressed package attributes section in such a case.

The same still needs to be done for the TOC section.
2011-11-25 06:18:57 +01:00
Ingo Weinhold
443be501c0 Use fHeapOffset instead of sizeof(hpkg_header) 2011-11-25 06:18:57 +01:00
Ingo Weinhold
e6ebdaaf21 Move RegisterPackageInfo() to Finish() 2011-11-25 06:18:56 +01:00
Ingo Weinhold
5bb68d85fc Add PackageReaderImpl heapOffset/Size getters 2011-11-25 06:18:56 +01:00
Ingo Weinhold
78811461b1 Add BLowLevelPackageContentHandler section hooks
* Add hooks HandleSectionStart() and HandleSectionEnd(). They are
  invoked to bracket package file section, so the handler can
  discriminate which section the attributes belong to.
  HandleSectionStart() features a return parameter _handleSection, which
  allows to handler to pick which sections it wants to handle.
* "package dump" does now print the section names.
2011-11-25 06:18:55 +01:00
Ingo Weinhold
f9caa05c2a Define IDs for package section 2011-11-25 06:18:55 +01:00
Ingo Weinhold
1dd17fa77f Add Array.h and RangeArray.h build headers 2011-11-25 06:18:54 +01:00
Ingo Weinhold
29d45d5ee7 Add RangeArray utility class
Templatized class for managing a set of sorted non-overlapping integer
ranges. Merges and splits ranges as necessary.
2011-11-25 06:18:53 +01:00
Ingo Weinhold
26589141fc Declare Array destructor inline 2011-11-25 06:18:53 +01:00
Ingo Weinhold
9395c27062 Move Debugger's Array class to headers/shared 2011-11-25 06:18:52 +01:00
Ingo Weinhold
b6d9fe9a6b PackageWriterImpl::_AddEntry(): Improve output
Print the relative path instead of only the leaf name.
2011-11-25 06:18:52 +01:00
Ingo Weinhold
8524dd3660 SubPathAdder: Check for overflows, omit initial / 2011-11-25 06:18:51 +01:00