experimental and untested reimplementation of sql based IP pool

uses address preallocation and separate address/lease tables for linear lookup time
This commit is contained in:
Martin Willi
2008-07-22 14:56:15 +00:00
parent 32f5ee159e
commit f7198e7e8c
4 changed files with 319 additions and 251 deletions
+13 -4
View File
@@ -157,15 +157,14 @@ CREATE TABLE pools (
`name` varchar(32) NOT NULL,
`start` varbinary(16) NOT NULL,
`end` varbinary(16) NOT NULL,
`next` varbinary(16) NOT NULL,
`timeout` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
UNIQUE (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS leases;
CREATE TABLE leases (
DROP TABLE IF EXISTS addresses;
CREATE TABLE addresses (
`id` int(10) unsigned NOT NULL auto_increment,
`pool` int(10) unsigned NOT NULL,
`address` varbinary(16) NOT NULL,
@@ -175,7 +174,17 @@ CREATE TABLE leases (
PRIMARY KEY (`id`),
INDEX (`pool`),
INDEX (`identity`),
INDEX (`released`)
INDEX (`address`)
);
DROP TABLE IF EXISTS leases;
CREATE TABLE leases (
`id` int(10) unsigned NOT NULL auto_increment,
`address` int(10) unsigned NOT NULL,
`identity` int(10) unsigned NOT NULL,
`acquired` int(10) unsigned NOT NULL,
`released` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`)
);