summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2012-09-14Switch fingerprinting to use the global string poolPanu Matilainen1-4/+1
- Transaction preparation fingerprinting now shares all the strings from rpmfi's etc. Rpmdb basename iterator still needs a private pool as there's nowhere to get a pool handle (for now at least). - We no longer need to (and actually we couldn't) freeze the pool before fingerprinting.
2012-09-14Allow passing a shared pool for finger print cachePanu Matilainen4-5/+6
- Both callers updated to still use a private pool so no practical change here.
2012-09-14Remove scareMemory remnants from the internal API, fixup callersPanu Matilainen4-6/+4
2012-09-14Switch fingerprint subDir to pool idsPanu Matilainen1-46/+47
- <gulp> but no anomalies noted by test-suite, valgrind or a bit of manual testing. Time will tell... - Memory is no longer scarce or scary, the strings are simply owned by the pool in all circumstances. Eliminate scareMemory foobar from the fingerprinting internals.
2012-09-14Switch fingerprint basename to pool idsPanu Matilainen1-9/+16
- For now we're doing a fair amount of extra work and wasting memory as data is in different pools so we need to copy to get the strings and ids into our private pool. This will go away later.
2012-09-14Switch fingerprint cache-entry dirnames to pool idsPanu Matilainen1-17/+28
- This is fairly straightforward (or supposed to be...) especially now that its all hidden behind APIs. Note that we no longer bother precalculating the hash as a pool-id's hash is a no-cost operation, for strings it was far more expensive.
2012-09-14Add a string pool to fingerprint cache (but not yet used)Panu Matilainen1-0/+3
2012-09-14Make fingerprint struct opaque outside fprint.cPanu Matilainen5-34/+37
- rpmfi cannot know anything about the storage, so rpmfiFpxIndex() cannot be... change it to rpmfiFps() which only returns the pointer we got from fpLookupList() - Change fpCacheGetByFp() to assume it gets passed an array of fps, and take an additional index argument. Return the fingerprint pointer on success, NULL on not found to allow further operations on the fp without knowing its internals.
2012-09-14Change fpLookup() to return malloced memory (on first call)Panu Matilainen4-16/+20
- If the fingerprint pointer passed to it is NULL then allocate space for a new fingerprint, otherwise reuse the previous space. This should allow optimizing the case where repeatedly calling and directory doesn't change inside fpc so callers dont need special-case code for this. For now, we dont care about optimizations, other than making it possible later.
2012-09-14Make fingerprint cache entry opaque, add some kind of API for the needed bitsPanu Matilainen3-14/+30
- Only disk-space calculations need the actual entry contents, add getter for dir name and device. We're passing the cache to these getters too: its not currently unusedd but will be needed for directory name pool id->string translation once we get there...
2012-09-14Hide away the FP_EQUAL macrosPanu Matilainen2-12/+10
2012-09-14Change fpLookupList() to return malloced memoryPanu Matilainen3-13/+14
- Eliminates one place where knowledge about fingerprint internals has been needed, now rpmfi just gets (an supposedly) opaque blob back.
2012-09-14Add internal API for fingerprint lookup-and-comparePanu Matilainen3-4/+15
- Replace the direct hackery in rpmdb internals with a little less direct hackery...
2012-09-14Bury the fingerprint hash-types into fprint.c, clean upPanu Matilainen3-46/+25
- fprint.h only needs rpmtypes.h now, remove historical leftovers - Avoids having to define the hash types multiple times as they're now buried out of sight - fpHashFunction() and fpLookupSubdir() can now be made static, do so...
2012-09-14Move the entire fingerprint cache population into fprint.cPanu Matilainen3-67/+76
- Rename addFingerprints() to fpCachePopulate() and move into fprint.c. This doesn't really belong here as it requires fprint becoming aware of transactions and all, but at least these are all controlled API accesses unlike where in transaction.c this was messing with somebody elses data structures directly. - Move the by-fingerprint creation to fpCachePopulate() so it gets lazily done as needed and copy the original hash-size heuristics back here.
2012-09-14Hide by-fingerprint hash into fingerprint cache, add minimal API bitsPanu Matilainen3-18/+29
- For now, always create the by-fingerprint hash although rpmdb usage doesn't need it. Next steps will fix... - Add wrapper API for retrieving the records, adjust callers - No functional changes, at least intended ones... just first steps towards eliminating the hash-jungle and forcing a single API through which this stuff gets handled
2012-09-14Make fingerprint cache opaque outside fprint.cPanu Matilainen2-7/+7
- Not that it matters much when everything else is wide open but gotta start with something...
2012-09-13Convert our dependency checking code to use the new rpmdsMatches()Panu Matilainen2-10/+17
- Instead of adding three more pool-aware versions of the old API's, convert the main callers to the newew more flexible API. As a "minor side-effect" these now use the transaction string-pool as well, so ALL our pre-transaction dependency sets are now using the global pool.
2012-09-13Unify the three rpmdsFooMatchesDep() functions into onePanu Matilainen2-36/+46
- These all do more or less the same thing, easily handled with a common function that takes a couple of more extra parameters. The old variants become just wrappers to call the pool-aware rpmdsMatches() with suitable arguments.
2012-09-13Use transaction string pool for rpmlib() dependencies tooPanu Matilainen1-1/+1
- This wasn't possible with the former static rpmlib() dependency set as it would've kept the potentially huge global pool referenced throughout process lifetime.
2012-09-13Add pool-aware version of rpmdsRpmlib()Panu Matilainen2-3/+18
2012-09-13Hang rpmlib() dependency set onto transaction setPanu Matilainen3-7/+5
- Eliminates the cumbersome static rpmlib ds instance which can never be freed, as a member of the transaction set it simply gets cleaned out along with other transaction (dependency) data.
2012-09-13Use transaction string pool for ensureOlder() dependency setsPanu Matilainen1-3/+6
2012-09-13Use transaction string pool for findPos() dependency setsPanu Matilainen1-4/+8
2012-09-13Put transaction element "self" dependency set into global pool tooPanu Matilainen1-1/+1
2012-09-13Add pool-aware versions of rpmdsThis() and rpmdsSingle()Panu Matilainen2-7/+44
- Pooh ... I mean pool ... bah. The previous versions become simple wrappers to the pool-aware ones, using a private pool always. rpmdsCurrent() doesn't need pool-variant as its inherits its pool from the parent.
2012-09-13Simplify single ds creationPanu Matilainen1-12/+7
- Eliminate the pre-created pool wtf'ery (what was I thinking?), just create a ds with zero id's and fill them up once we have the ds.
2012-09-12Whoopsie, unbreak checking of installed dependenciesPanu Matilainen2-4/+5
- The dependency sets created from installed headers during rpmtsCheck() were using a private pool and thus ids not matching with the ones in the global pool. Oops. Somehow none of our test-suite cases caught this, looks like we'll need more tests... Also the safe-guard assert()'s are in all the wrong places for catching this particular problem. Doh :) - There's a chicken-and-egg situation involved: in order to do this, the global pool needs to be in unfrozen state during rpmtsCheck(), which was not possible before switching rpmal provides (and files) to pool ids. Now that it *is* using pool id's, move the freeze-point to rpmtsPrepare() as the fingerprinting has similar issues with moving strings.
2012-09-12Switch rpmal file hash to use pool id's instead of stringsPanu Matilainen1-23/+15
2012-09-12Switch rpmal provide hash to use pool id's instead of stringsPanu Matilainen1-7/+19
2012-09-12Add a some transition-period asserts to ensure pool-usage sanityPanu Matilainen1-0/+19
2012-09-12Allow keeping hash table around on pool freeze, adjust callersPanu Matilainen3-5/+5
- Pool id -> string always works with a frozen pool, but in some cases we'll need to go the other way, allow caller to specify whether string -> id lookups should be possible on frozen pool. - On glibc, realloc() to smaller size doesn't move the data but on other platforms (including valgrind) it can and does move, which would require a full rehash. For now, just leave all the data alone unless we're also freeing the hash, the memory savings isn't much for a global pool (which is where this matters)
2012-09-12Add getters for rpmds dependency name and EVR pool idsPanu Matilainen2-0/+39
2012-09-12Add getters for rpmfi base- and directory name pool id'sPanu Matilainen3-0/+42
2012-09-12Pass transaction pool to rpmal (but not used yet)Panu Matilainen3-4/+10
2012-09-12Actually enable the global transaction string poolPanu Matilainen1-0/+8
- With this, practically all transaction member file (base- and dirname) and dependency strings get now stored in a giant transaction global string pool. Greenpeace applaudes us for all the rain-forests that will be saved by the memory savings... not. Some memory is saved but the real wins only start when everything is converted to use pool id's instead of string pointers. Also we're still creating a ridiculous number of private pools from various sources, but we gotta start someplace.
2012-09-12Add infastructure for global transaction set string poolPanu Matilainen6-7/+46
- Add a pool pointer to to ts members struct and a getter function - Grab the global pool for rpmte dependency- and file info creation, if its NULL then the sets will use private pools of their own. - Add the (currently) required magic voodoo rain-dance to freeze and unfreeze the pool as necessary wrt new element additions: for current rpmal and fingerprinting to work, the string pointers must be immovable. - This is infrastructure only: nothing creates the global pool yet, so everything is still using private pools.
2012-09-12Add getter methods for rpmds and rpmfi string pool handlePanu Matilainen4-0/+23
2012-09-12Delay transaction added packages rpmal creation until requiredPanu Matilainen2-5/+22
- We're not using the added rpmal for anything before rpmtsCheck() and/or rpmtsOrder(), so this shouldn't break anything either. This is probably a more or less temporary setup to make string pointer -> pool id transition a bit easier.
2012-09-12Add an nternal rpmal create+populate helper function, use for erased packagesPanu Matilainen3-7/+21
- We'll need this shortly for added packages too...
2012-09-11Oops, only private pool should be frozen on ds createPanu Matilainen1-2/+3
2012-09-11Add an alternative rpmds constructor to allow shared pool usagePanu Matilainen2-2/+18
- rpmdsNewPool() allows specifying shared/private pool, and rpmdsNew() is now just a wrapper to always call it with NULL (ie private) pool.
2012-09-11Freeze the rpmlib dependency set pool on successful returnPanu Matilainen1-0/+2
- ...to avoid wasting memory on the relatively static data. We could handle the rpmlib ds singleton behavior here too but it would change semantics. Ponder about it later... - Would be nicer to have rpmdsMerge() freeze on return, but that gets called in loops so we'd be doing a whole lot of huffing and puffing recreating the pools on each entry.
2012-09-11Further split single ds creation into two, sighPanu Matilainen1-16/+31
- Allow rpmdsCurrent() to share the pool and id's of its "parent" ds instead of having to repeatedly create and tear down entire pools just for a couple of strings. Used by python bindings for rpmds iteration so we'll want to be reasonably efficient. - For now, rpmdsSingle() and rpmdsThis() always get a private pool, wasteful as it might be, but at least now we can freeze them.
2012-09-11Unify the common parts of rpmds creation into a helper functionPanu Matilainen1-27/+26
- No functional changes, just sanity-refactoring
2012-09-11Eliminate assert()'s from rpmdsMerge()Panu Matilainen1-5/+9
- These "can't happen" cases where EVR/Flags in source ds are missing are just as easy to handle as is dying, handling is saner...
2012-09-11Eliminate assert()'s from rpmdsDup()Panu Matilainen1-7/+8
- The "can't happen" case where EVR/Flags are not present is just as easily handled as dying.
2012-09-11Switch dependency sets to use string pool storage for names and evrsPanu Matilainen1-71/+56
- Always push dependency names and versions into string pool (private for now). This is terribly wasteful for single ds items, even more so for rpmdsCurrent() but to keep the initial switch-over changes to minimum we'll deal with those later. - While we freeze the pool for ds data from headers, single ds items are on purpose not frozen for now, due to interactions with rpmdsCurrent() and rpmds merging. - Eliminate no longer needed rpmdsDupArgv(), we're now just copying a bunch of integers around. Sanitize rpmdsMerge() now that we can: realloc and shift the data instead of recreating all of N, EVR and Flags.
2012-09-11Rename td2pool as rpmtdToPool, export and optimizePanu Matilainen3-13/+30
- Using rpmtd iteration for this is slow and stupid as we keep pointlessly re-re-re-re-re-validating the tag type and indexes. - Change argument order to source -> destination - Move to rpmtd.c where it belongs and make public with a decent name. Not sure if this is the kind of an API we really want to make public but ... at least for now it'll do.
2012-09-11Eliminate direct rpmds name (and flags) access on rpmdsNew()Panu Matilainen1-3/+5