mirror of
https://github.com/lionsoul2014/ip2region.git
synced 2026-01-25 17:16:11 +00:00
50 lines
1.2 KiB
C#
50 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace DbMaker
|
|
{
|
|
/// <summary>
|
|
/// database configuration class
|
|
/// </summary>
|
|
public class DbConfig
|
|
{
|
|
public DbConfig(int totalHeaderSize)
|
|
{
|
|
if (totalHeaderSize % 8 != 0)
|
|
{
|
|
throw new DbMakerConfigException("totalHeaderSize must be times of 8");
|
|
}
|
|
|
|
TotalHeaderSize = totalHeaderSize;
|
|
IndexBlockSize = 8192; //4*2048
|
|
}
|
|
|
|
public DbConfig() : this(8 * 2048)
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// total header data block size
|
|
/// </summary>
|
|
public int TotalHeaderSize { get; set; }
|
|
/// <summary>
|
|
/// max index data block size
|
|
/// u should always choice the fastest read block size
|
|
/// </summary>
|
|
public int IndexBlockSize { get; set; }
|
|
|
|
public DbConfig SetTotalHeaderSize(int totalHeaderSize)
|
|
{
|
|
this.TotalHeaderSize = totalHeaderSize;
|
|
return this;
|
|
}
|
|
public DbConfig SetIndexBlockSize(int dataBlockSize)
|
|
{
|
|
this.IndexBlockSize = dataBlockSize;
|
|
return this;
|
|
}
|
|
}
|
|
}
|