docs: csharp maker data structure 注释
This commit is contained in:
parent
8199a08ee0
commit
9d416f8918
|
|
@ -1,4 +1,55 @@
|
||||||
using System.Text;
|
// Copyright 2022 The Ip2Region Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a Apache2.0-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// @Author Alan Lee <lzh.shap@gmail.com>
|
||||||
|
// @Date 2022/8/8
|
||||||
|
|
||||||
|
// --- Ip2Region v2.0 data structure
|
||||||
|
//
|
||||||
|
// +----------------+--------------------------+---------------+--------------+
|
||||||
|
// | header space | vector speed up index | data payload | block index |
|
||||||
|
// +----------------+--------------------------+---------------+--------------+
|
||||||
|
// | 256 bytes | 512 KiB (fixed) | dynamic size | dynamic size |
|
||||||
|
// +----------------+--------------------------+---------------+--------------+
|
||||||
|
//
|
||||||
|
// 1. padding space : for header info like block index ptr, version, release date eg ... or any other temporary needs.
|
||||||
|
// -- 2bytes: version number, different version means structure update, it fixed to 2 for now
|
||||||
|
// -- 2bytes: index algorithm code.
|
||||||
|
// -- 4bytes: generate unix timestamp (version)
|
||||||
|
// -- 4bytes: index block start ptr
|
||||||
|
// -- 4bytes: index block end ptr
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// 2. data block : region or whatever data info.
|
||||||
|
// 3. segment index block : binary index block.
|
||||||
|
// 4. vector index block : fixed index info for block index search speed up.
|
||||||
|
// space structure table:
|
||||||
|
// -- 0 -> | 1rt super block | 2nd super block | 3rd super block | ... | 255th super block
|
||||||
|
// -- 1 -> | 1rt super block | 2nd super block | 3rd super block | ... | 255th super block
|
||||||
|
// -- 2 -> | 1rt super block | 2nd super block | 3rd super block | ... | 255th super block
|
||||||
|
// -- ...
|
||||||
|
// -- 255 -> | 1rt super block | 2nd super block | 3rd super block | ... | 255th super block
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// super block structure:
|
||||||
|
// +-----------------------+----------------------+
|
||||||
|
// | first index block ptr | last index block ptr |
|
||||||
|
// +-----------------------+----------------------+
|
||||||
|
//
|
||||||
|
// data entry structure:
|
||||||
|
// +--------------------+-----------------------+
|
||||||
|
// | 2bytes (for desc) | dynamic length |
|
||||||
|
// +--------------------+-----------------------+
|
||||||
|
// data length whatever in bytes
|
||||||
|
//
|
||||||
|
// index entry structure
|
||||||
|
// +------------+-----------+---------------+------------+
|
||||||
|
// | 4bytes | 4bytes | 2bytes | 4 bytes |
|
||||||
|
// +------------+-----------+---------------+------------+
|
||||||
|
// start ip end ip data length data ptr
|
||||||
|
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace IP2RegionMaker.XDB
|
namespace IP2RegionMaker.XDB
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue