Чтобы перевести X,Y в ключ, нужно сделать побитовое чередование X с Y, а затем перевернуть их (swap). В итоге получится примерно такой ключ: 0x0000000007201a58.
Обратная операция, очевидно будет начинаться со swap-а, с последующим чередующимся распихиванием битов то в X, то в Y.
Реализацию можно подсмотреть тут:
https://bitbucket.org/sas_team/sas.plan ... ult#cl-235Да, в БД ещё хранится один мета-ключ 0xFFFFFFFFFFFFFFFF и его нужно игнорить. Там информация о проекции тайлов.
В версионном Беркли там ещё чутка всего больше.
Из стандартных утилит могу посоветовать db_dump, которая умеет представить файл БД в человеко-читаемом виде.
Команда
db_dump -da 45.55.tne выведет что-то вроде такого:
- Код: Выделить всё
In-memory DB structure:
btree: 0x8090000 (open called, read-only, subdatabases)
bt_meta: 0 bt_root: 1
bt_minkey: 2
bt_compare: 0x100065a0 bt_prefix: 0x100065f0
bt_compress: 0 bt_decompress: 0
bt_lpgno: 0
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
page 0: btree metadata: LSN [5][988282]: level 0
magic: 0x53162
version: 9
pagesize: 1024
type: 9
metaflags 0
keys: 0 records: 0
free list: 0
last_pgno: 12
flags: 0x20 (multiple-databases)
uid: b4 55 1 0 0 0 5 0 d8 b5 31 3b 0 0 0 0 0 0 0 0
minkey: 2
root: 1
page 1: btree leaf: LSN [2][1792572]: level 1
prev: 0 next: 0 entries: 2 offset: 1012
[000] 1020 len: 0
[001] 1012 len: 4 data: 00000002
page 2: btree metadata: LSN [2][1793780]: level 0
magic: 0x53162
version: 9
pagesize: 1024
type: 9
metaflags 0
keys: 0 records: 0
free list: 0
last_pgno: 2
flags: 0x20 (multiple-databases)
uid: b4 55 1 0 0 0 5 0 d8 b5 31 3b 0 0 0 0 0 0 0 0
minkey: 2
root: 3
page 3: btree internal: LSN [5][988350]: level 2 records: 0
entries: 9 offset: 852
[000] 1012 pgno: 4 type: 1 len: 0
[001] 872 pgno: 11 type: 1 len: 8 data: 0000000007201a5d
[002] 852 pgno: 12 type: 1 len: 8 data: 0000000007201b08
[003] 892 pgno: 10 type: 1 len: 8 data: 000000000720877e
[004] 932 pgno: 8 type: 1 len: 8 data: 00000000072087f5
[005] 912 pgno: 9 type: 1 len: 8 data: 0000000007209228
[006] 972 pgno: 6 type: 1 len: 8 data: 000000000720923b
[007] 992 pgno: 5 type: 1 len: 8 data: 000000000720928a
[008] 952 pgno: 7 type: 1 len: 8 data: 0000000007209299
page 4: btree leaf: LSN [5][987946]: level 1
prev: 0 next: 11 entries: 10 offset: 824
[000] 932 len: 8 data: 0000000007201a58
[001] 904 len: 24 data: 544c440365d4a7490000000085d1e7bdcd34e44000000000
[002] 892 len: 8 data: 0000000007201a59
[003] 864 len: 24 data: 544c4403e20927ad000000009d19eabdcd34e44000000000
[004] 972 len: 8 data: 0000000007201a5a
[005] 944 len: 24 data: 544c4403b207779a00000000e410e7bdcd34e44000000000
[006] 1012 len: 8 data: 0000000007201a5b
[007] 984 len: 24 data: 544c44030f8b9c5500000000bf6cd9bdcd34e44000000000
[008] 852 len: 8 data: 0000000007201a5c
[009] 824 len: 24 data: 544c44037b25049a000000003edaeabdcd34e44000000000
page 5: btree leaf: LSN [3][3503039]: level 1
prev: 6 next: 7 entries: 24 offset: 544
[000] 1012 len: 8 data: 000000000720928a
[001] 984 len: 24 data: 544c4403310793ad00000000d164ec49cb34e44000000000
[002] 972 len: 8 data: 000000000720928b
[003] 944 len: 24 data: 544c4403b5e09fce0000000047beea49cb34e44000000000
[004] 932 len: 8 data: 000000000720928c
[005] 904 len: 24 data: 544c440379d2cdee00000000a964d849cb34e44000000000
[006] 892 len: 8 data: 000000000720928d
[007] 864 len: 24 data: 544c440326a45f5e00000000139ad549cb34e44000000000
[008] 852 len: 8 data: 000000000720928e
[009] 824 len: 24 data: 544c4403c31b332a000000009787e949cb34e44000000000
[010] 812 len: 8 data: 000000000720928f
[011] 784 len: 24 data: 544c4403a5ab1ecb000000007bede749cb34e44000000000
[012] 772 len: 8 data: 0000000007209290
[013] 744 len: 24 data: 544c44032920a05900000000bf0de249cb34e44000000000
[014] 732 len: 8 data: 0000000007209291
[015] 704 len: 24 data: 544c440329daeb1000000000da6ef849cb34e44000000000
[016] 692 len: 8 data: 0000000007209292
[017] 664 len: 24 data: 544c44032ed6e3f3000000006bf2e349cb34e44000000000
[018] 652 len: 8 data: 0000000007209293
[019] 624 len: 24 data: 544c440367f2ed7b000000001d99f949cb34e44000000000
[020] 572 len: 8 data: 0000000007209296
[021] 544 len: 24 data: 544c44032c04d01600000000a29fbdb2cb34e44000000000
[022] 612 len: 8 data: 0000000007209298
[023] 584 len: 24 data: 544c4403d927b8bb000000002ff1e449cb34e44000000000
page 6: btree leaf: LSN [3][8769984]: level 1
prev: 9 next: 5 entries: 22 offset: 584
[000] 1012 len: 8 data: 000000000720923b
[001] 984 len: 24 data: 544c44037f51bf060000000051c8f649cb34e44000000000
[002] 972 len: 8 data: 0000000007209280
[003] 944 len: 24 data: 544c44036e4a37ba000000004cc3f049cb34e44000000000
[004] 932 len: 8 data: 0000000007209281
[005] 904 len: 24 data: 544c4403802a90dc000000008754db49cb34e44000000000
[006] 892 len: 8 data: 0000000007209282
[007] 864 len: 24 data: 544c4403edc34c5000000000d292ef49cb34e44000000000
[008] 852 len: 8 data: 0000000007209283
[009] 824 len: 24 data: 544c4403ebb1d942000000004b53dc49cb34e44000000000
[010] 812 len: 8 data: 0000000007209284
[011] 784 len: 24 data: 544c4403aec964c400000000c131de49cb34e44000000000
[012] 772 len: 8 data: 0000000007209285
[013] 744 len: 24 data: 544c44037ab56832000000005a91d249cb34e44000000000
[014] 732 len: 8 data: 0000000007209286
[015] 704 len: 24 data: 544c44034201f5e6000000003653d249cb34e44000000000
[016] 692 len: 8 data: 0000000007209287
[017] 664 len: 24 data: 544c4403e920cffe00000000b955d549cb34e44000000000
[018] 652 len: 8 data: 0000000007209288
[019] 624 len: 24 data: 544c4403374ca0e50000000049eced49cb34e44000000000
[020] 612 len: 8 data: 0000000007209289
[021] 584 len: 24 data: 544c44031c1ef42f000000004f20d849cb34e44000000000
page 7: btree leaf: LSN [3][3503855]: level 1
prev: 5 next: 0 entries: 40 offset: 236
[000] 1012 len: 8 data: 0000000007209299
[001] 984 len: 24 data: 544c44034982e788000000007e06fc49cb34e44000000000
[002] 972 len: 8 data: 000000000720929a
[003] 944 len: 24 data: 544c4403708f089000000000cab6e649cb34e44000000000
[004] 932 len: 8 data: 000000000720929b
[005] 904 len: 24 data: 544c4403e8d8e92f00000000a09bfc49cb34e44000000000
[006] 384 len: 8 data: 000000000720929c
[007] 356 len: 24 data: 544c4403475d90ca00000000d101bfb2cb34e44000000000
[008] 344 len: 8 data: 000000000720929e
[009] 316 len: 24 data: 544c4403da669d27000000003418c1b2cb34e44000000000
[010] 464 len: 8 data: 00000000072092a0
[011] 436 len: 24 data: 544c4403ea26ca0900000000e768b7b2cb34e44000000000
[012] 892 len: 8 data: 00000000072092a1
[013] 864 len: 24 data: 544c44031d68fd08000000004d99aeb2cb34e44000000000
[014] 504 len: 8 data: 00000000072092a2
[015] 476 len: 24 data: 544c44033646e75000000000b9afb5b2cb34e44000000000
[016] 544 len: 8 data: 00000000072092a3
[017] 516 len: 24 data: 544c4403f016ed6700000000e491b4b2cb34e44000000000
[018] 852 len: 8 data: 00000000072092a4
[019] 824 len: 24 data: 544c44032b0be533000000005938acb2cb34e44000000000
[020] 812 len: 8 data: 00000000072092a5
[021] 784 len: 24 data: 544c4403f632251d000000005f33abb2cb34e44000000000
[022] 584 len: 8 data: 00000000072092a6
[023] 556 len: 24 data: 544c44038dfa177200000000caa0b2b2cb34e44000000000
[024] 772 len: 8 data: 00000000072092a7
[025] 744 len: 24 data: 544c44038953b7cc00000000bd7cb1b2cb34e44000000000
[026] 732 len: 8 data: 00000000072092b0
[027] 704 len: 24 data: 544c44034c1720a8000000002acca3b2cb34e44000000000
[028] 692 len: 8 data: 00000000072092b1
[029] 664 len: 24 data: 544c44038ea5a97a000000007f90a1b2cb34e44000000000
[030] 652 len: 8 data: 00000000072092b2
[031] 624 len: 24 data: 544c440381b23dbf0000000090c3afb2cb34e44000000000
[032] 424 len: 8 data: 00000000072092b3
[033] 396 len: 24 data: 544c4403ab47ce5b00000000bd86b8b2cb34e44000000000
[034] 304 len: 8 data: 00000000072092b4
[035] 276 len: 24 data: 544c4403693877c0000000002f1dc2b2cb34e44000000000
[036] 264 len: 8 data: 00000000072092b6
[037] 236 len: 24 data: 544c44032aea8519000000006ef5c3b2cb34e44000000000
[038] 612 len: 8 data: ffffffffffffffff
[039] 596 len: 12 data: 4d4944010468edf9c90e0000
page 8: btree leaf: LSN [5][982190]: level 1
prev: 10 next: 9 entries: 22 offset: 584
[000] 1012 len: 8 data: 00000000072087f5
[001] 984 len: 24 data: 544c440355e0209d000000004fffbbb2cb34e44000000000
[002] 972 len: 8 data: 00000000072087f6
[003] 944 len: 24 data: 544c44036d6608da000000008c38c5b2cb34e44000000000
[004] 932 len: 8 data: 00000000072087f7
[005] 904 len: 24 data: 544c440338392c51000000000cd5bab2cb34e44000000000
[006] 892 len: 8 data: 0000000007209220
[007] 864 len: 24 data: 544c44030b16c4af0000000015448f13cc34e44000000000
[008] 852 len: 8 data: 0000000007209221
[009] 824 len: 24 data: 544c440358e0874a00000000b9db9213cc34e44000000000
[010] 812 len: 8 data: 0000000007209222
[011] 784 len: 24 data: 544c44033e9c31a500000000fa1a8313cc34e44000000000
[012] 772 len: 8 data: 0000000007209223
[013] 744 len: 24 data: 544c44036ec2d8e700000000c5428613cc34e44000000000
[014] 732 len: 8 data: 0000000007209224
[015] 704 len: 24 data: 544c44037478c384000000008c938613cc34e44000000000
[016] 692 len: 8 data: 0000000007209225
[017] 664 len: 24 data: 544c440374fa9e900000000091138913cc34e44000000000
[018] 652 len: 8 data: 0000000007209226
[019] 624 len: 24 data: 544c4403728ca321000000009b568013cc34e44000000000
[020] 612 len: 8 data: 0000000007209227
[021] 584 len: 24 data: 544c4403e0a8d8f0000000008f6a8913cc34e44000000000
page 9: btree leaf: LSN [3][8772020]: level 1
prev: 8 next: 6 entries: 26 offset: 504
[000] 1012 len: 8 data: 0000000007209228
[001] 984 len: 24 data: 544c4403dafb0c3700000000a0d68213cc34e44000000000
[002] 972 len: 8 data: 0000000007209229
[003] 944 len: 24 data: 544c440359f690f600000000d3058013cc34e44000000000
[004] 932 len: 8 data: 000000000720922a
[005] 904 len: 24 data: 544c4403e3d78ae2000000004376f249cb34e44000000000
[006] 892 len: 8 data: 000000000720922b
[007] 864 len: 24 data: 544c4403ca88326f0000000005ccf349cb34e44000000000
[008] 852 len: 8 data: 000000000720922c
[009] 824 len: 24 data: 544c44030a6c458200000000045e7a13cc34e44000000000
[010] 812 len: 8 data: 000000000720922d
[011] 784 len: 24 data: 544c4403132b01c100000000d02e7d13cc34e44000000000
[012] 772 len: 8 data: 000000000720922e
[013] 744 len: 24 data: 544c4403003858b80000000045a4f549cb34e44000000000
[014] 732 len: 8 data: 000000000720922f
[015] 704 len: 24 data: 544c4403155a8647000000001724df49cb34e44000000000
[016] 572 len: 8 data: 0000000007209230
[017] 544 len: 24 data: 544c44032ee63db700000000a5139313cc34e44000000000
[018] 532 len: 8 data: 0000000007209231
[019] 504 len: 24 data: 544c440310d1c1000000000098f99813cc34e44000000000
[020] 692 len: 8 data: 0000000007209232
[021] 664 len: 24 data: 544c4403543064b10000000022977413cc34e44000000000
[022] 652 len: 8 data: 0000000007209238
[023] 624 len: 24 data: 544c4403c9f9b622000000006abc7413cc34e44000000000
[024] 612 len: 8 data: 000000000720923a
[025] 584 len: 24 data: 544c44035a02542f000000003115e149cb34e44000000000
page 10: btree leaf: LSN [5][988350]: level 1
prev: 12 next: 8 entries: 22 offset: 584
[000] 1012 len: 8 data: 000000000720877e
[001] 984 len: 24 data: 544c44037c4356db00000000f8f30a4acb34e44000000000
[002] 972 len: 8 data: 000000000720877f
[003] 944 len: 24 data: 544c440394d3f67300000000cf07054acb34e44000000000
[004] 932 len: 8 data: 00000000072087d4
[005] 904 len: 24 data: 544c440377c59d6e000000009eaf0a4acb34e44000000000
[006] 892 len: 8 data: 00000000072087d5
[007] 864 len: 24 data: 544c44032443821d00000000dd4f024acb34e44000000000
[008] 852 len: 8 data: 00000000072087d6
[009] 824 len: 24 data: 544c4403923aebdb00000000073c084acb34e44000000000
[010] 812 len: 8 data: 00000000072087d7
[011] 784 len: 24 data: 544c4403f7ddd6e30000000071ec014acb34e44000000000
[012] 772 len: 8 data: 00000000072087dc
[013] 744 len: 24 data: 544c440346576f000000000064d2074acb34e44000000000
[014] 732 len: 8 data: 00000000072087dd
[015] 704 len: 24 data: 544c4403392c38ef00000000a372ff49cb34e44000000000
[016] 692 len: 8 data: 00000000072087de
[017] 664 len: 24 data: 544c440346c313c600000000bb3f054acb34e44000000000
[018] 652 len: 8 data: 00000000072087df
[019] 624 len: 24 data: 544c44036120e96500000000b8e3fe49cb34e44000000000
[020] 612 len: 8 data: 00000000072087f4
[021] 584 len: 24 data: 544c4403bd8659a600000000cb10c7b2cb34e44000000000
page 11: btree leaf: LSN [5][990386]: level 1
prev: 4 next: 12 entries: 26 offset: 504
[000] 1012 len: 8 data: 0000000007201a5d
[001] 984 len: 24 data: 544c4403afc2c9bc000000004318dcbdcd34e44000000000
[002] 972 len: 8 data: 0000000007201a5e
[003] 944 len: 24 data: 544c44036c7511200000000036f4dabdcd34e44000000000
[004] 932 len: 8 data: 0000000007201a5f
[005] 904 len: 24 data: 544c4403bf6ed38d00000000ca58d0bdcd34e44000000000
[006] 532 len: 8 data: 0000000007201a65
[007] 504 len: 24 data: 544c44031b021e13000000005dd0f2bdcd34e44000000000
[008] 572 len: 8 data: 0000000007201a67
[009] 544 len: 24 data: 544c44031b021e13000000005dd0f2bdcd34e44000000000
[010] 892 len: 8 data: 0000000007201a70
[011] 864 len: 24 data: 544c440348e9d09700000000372ce5bdcd34e44000000000
[012] 852 len: 8 data: 0000000007201a71
[013] 824 len: 24 data: 544c44032fdd10a9000000007debd7bdcd34e44000000000
[014] 812 len: 8 data: 0000000007201a72
[015] 784 len: 24 data: 544c44035ede4547000000002b08e4bdcd34e44000000000
[016] 772 len: 8 data: 0000000007201a73
[017] 744 len: 24 data: 544c4403d1a77b5b000000003c6ad6bdcd34e44000000000
[018] 732 len: 8 data: 0000000007201a74
[019] 704 len: 24 data: 544c4403bd7b50170000000089d7cebdcd34e44000000000
[020] 692 len: 8 data: 0000000007201a75
[021] 664 len: 24 data: 544c4403a01d9d86000000000bdad1bdcd34e44000000000
[022] 652 len: 8 data: 0000000007201a76
[023] 624 len: 24 data: 544c4403dc3b2dd000000000c4e2d4bdcd34e44000000000
[024] 612 len: 8 data: 0000000007201a77
[025] 584 len: 24 data: 544c4403442d0998000000008361d3bdcd34e44000000000
page 12: btree leaf: LSN [5][989978]: level 1
prev: 11 next: 10 entries: 28 offset: 464
[000] 1012 len: 8 data: 0000000007201b08
[001] 984 len: 24 data: 544c4403517258c1000000008499ddbdcd34e44000000000
[002] 972 len: 8 data: 0000000007201b09
[003] 944 len: 24 data: 544c44037af208b300000000ebbeecbdcd34e44000000000
[004] 932 len: 8 data: 0000000007201b0a
[005] 904 len: 24 data: 544c440384e334130000000090bddebdcd34e44000000000
[006] 572 len: 8 data: 0000000007201b0b
[007] 544 len: 24 data: 544c4403fc06bf14000000008b7fedbdcd34e44000000000
[008] 892 len: 8 data: 0000000007201b20
[009] 864 len: 24 data: 544c4403566c844f0000000072ffe0bdcd34e44000000000
[010] 532 len: 8 data: 0000000007201b21
[011] 504 len: 24 data: 544c44038e0da79f00000000a4c7efbdcd34e44000000000
[012] 852 len: 8 data: 0000000007201b22
[013] 824 len: 24 data: 544c4403968b3e4b000000007e23e2bdcd34e44000000000
[014] 492 len: 8 data: 0000000007201b23
[015] 464 len: 24 data: 544c44035792304d00000000d924f0bdcd34e44000000000
[016] 812 len: 8 data: 0000000007208774
[017] 784 len: 24 data: 544c44033873df580000000075bb9813cc34e44000000000
[018] 772 len: 8 data: 0000000007208775
[019] 744 len: 24 data: 544c4403c28063230000000084f98e13cc34e44000000000
[020] 732 len: 8 data: 0000000007208776
[021] 704 len: 24 data: 544c4403de6bf981000000004dfd9513cc34e44000000000
[022] 692 len: 8 data: 0000000007208777
[023] 664 len: 24 data: 544c4403b807d04000000000b67f8c13cc34e44000000000
[024] 652 len: 8 data: 000000000720877c
[025] 624 len: 24 data: 544c44038c24611b00000000bcb29513cc34e44000000000
[026] 612 len: 8 data: 000000000720877d
[027] 584 len: 24 data: 544c440310484b930000000081228c13cc34e44000000000
page ## - страница в БД (размером 1k), и её содержимое по относительным оффсетам внутри страницы. len 8 data - это ключ, а len 24 data - его value (для tne из полезного там только дата скачки).