Anteru's blog
  • Consulting
  • Research
    • Assisted environment probe placement
    • Assisted texture assignment
    • Error Metrics for Smart Image Refinement
    • High-Quality Shadows for Streaming Terrain Rendering
    • Hybrid Sample-based Surface Rendering
    • Interactive rendering of Giga-Particle Fluid Simulations
    • Quantitative Analysis of Voxel Raytracing Acceleration Structures
    • Real-time Hybrid Hair Rendering
    • Scalable rendering for very large meshes
    • Subpixel Reconstruction Antialiasing
    • Tiled light trees
  • About
  • Archive

SimpleDB

January 18, 2008
  • Programming
  • Projects
approximately 1 minutes to read

For a small project of mine, I needed a really simple DB (so simple, you can’t call it a DB actually ;) ). The requirements were: - Fast lookup - Storage of raw byte streams for both key/data - Pure MSIL - otherwise, I would have used the BerkeleyDB - Checksumming for each entry to detect long-term corruption

I ended up with writing a very simple DB in C# … the trickiest part was to get the paging right, as the pages get ref-counted just like everything else, but you do actually want to know when the last handle to them finishes and flush them to disk. The DB is ~16 kb large (Binary), allows storing/loading of entries (no update so far, delete does not compact) as long as the entries are smaller than the page size. All entries are hashed before storage, so data corruption can be detected. Moreover, the index and free page table can be recreated just from the storage file. I’m using it currently for a small mail storage system, where it works pretty fine and is really simple to use – something which was crucial to me as I often need just one simple tool for something totally different and I hate spending hours just to fiddle around with some complex solution – for example SQLite – to write a simple wrapper around it for my own little needs (plus, most C# wrappers require the original binaries, which often run only on x86 but not on x64 as there are no binaries for that, let alone porting it to Mono …).

Previous post
Next post

Recent posts

  • Five years of GPU DB
    Posted on 2020-09-27
  • Enabling SSL in your local network
    Posted on 2020-05-17
  • Goodbye, Bitbucket!
    Posted on 2020-03-19
  • QEMU, KVM and trim
    Posted on 2020-01-26
  • Fixing network after Ubuntu 19.04 to 19.10 upgrade
    Posted on 2019-10-26
  • Older posts

Find me on the web

  • GitHub
  • GPU database
  • Projects

Follow me

NIV_Anteru

Contents © 2005-2021 | Anteru | Imprint/Impressum | Privacy policy/Datenschutz