![]() I guess I don't see the benefit a b-tree adds here. Yes, a document can just be a (ptr, length). But error handling with mmap is miserable, so I think it is wise to avoid mmap even in 64 bit. Hex Fiend does not use mmap because I wanted to support 4+GB files in 32 bit mode. By organizing the list as a b+tree, it's fast to find the slice at a given byte offset in the document. So there's no real dependence on the original file: a document may reference arbitrarily many files (until it's saved). The user may also open file2, copy part of it, and paste it at the end of the document. This splits the original slice at offset 75, so our new list is: Now the user scrolls to offset 75 and types 30 bytes. ![]() The b+tree is just an optimization on top of the list, and is not written to disk.įor example, say the user opens file1, which is 100 bytes. Great questions! A Hex Fiend document is represented in-memory as a list of slices of files and memory buffers. My tool can easily generate tags for any single block without knowing any special context or having any expensive-to-generate state - I just need a block number (i.e. This would be easy to adapt to - Postgres relation files always consist of a series of 8KiB blocks/pages. That said, it would be great if I could adapt pg_hexedit to a hex editor that had some kind of "best of both worlds" support for tags - tags that can be generated lazily and on-demand, when a portion of the file needs to be drawn or redrawn. Writing a C program that uses the struct definitions from the server itself makes the complexity quite manageable - the tool is basically feature complete, even though I haven't spent a huge amount of time on it. But even if it did I might not want to use them the on-disk format of PostgreSQL is much more complicated than most file formats, and isn't supposed to be consumed by third party tools. WxHe圎ditor doesn't support declarative tags. I'm generating huge XML files, which is slow, but there are simple workarounds to get acceptable performance. I procedurally generate a description of each file in a shell script, and then open the file in wxHe圎ditor. What I'm doing is pretty grotty, but works surprisingly well in practice. I understand why you favor a declarative template format for describing files with tags - that probably scales really nicely. I've invested quite a lot of effort in it, and it would be nice to have support for multiple hex editors. I am the author of a tool that generates wxHe圎ditor tags and annotations for Postgres relation files - pg_hexedit:
0 Comments
Leave a Reply. |