Linux QoS DB schema: Porovnání verzí

Z Freenetis Wiki
Přejít na: navigace, hledání
Řádek 1: Řádek 1:
 
Schema je na obrázku níže:
 
Schema je na obrázku níže:
 
[[Soubor:linux_qos_db_schema.png]]
 
[[Soubor:linux_qos_db_schema.png]]
 +
 +
Pro pochopení schematu je vhodné podívat se nejdřív na prezentaci o Linux QoS a U32 hashtables:
 +
 +
=SDL - SQL=
 +
        CREATE TABLE qos_qdiscs (
 +
                        id INT AUTO_INCREMENT NOT NULL,
 +
                        qos_qdisc_parent_id INT NOT NULL,
 +
                        interface_id INT NOT NULL,
 +
                        qdisc_id INT,
 +
                        Parent_id INT NOT NULL,
 +
                        PRIMARY KEY (id)
 +
        );
 +
 +
 +
        CREATE INDEX fk_qos_qdiscs_qos_qdiscs1 USING BTREE
 +
        ON qos_qdiscs
 +
        ( qos_qdisc_parent_id ASC );
 +
 +
        CREATE INDEX fk_qos_qdiscs_devices1 USING BTREE
 +
        ON qos_qdiscs
 +
        ( interface_id ASC );
 +
 +
        CREATE TABLE qos_hash_tables (
 +
                        id INT AUTO_INCREMENT NOT NULL,
 +
                        htid INT,
 +
                        buckets INT,
 +
                        qos_qdiscs_id INT NOT NULL,
 +
                        PRIMARY KEY (id)
 +
        );
 +
 +
 +
        CREATE INDEX fk_qos_hash_tables_qos_qdiscs1 USING BTREE
 +
        ON qos_hash_tables
 +
        ( qos_qdiscs_id ASC );
 +
 +
        CREATE TABLE qos_classes (
 +
                        id INT AUTO_INCREMENT NOT NULL,
 +
                        rate INT,
 +
                        ceil INT,
 +
                        classid INT,
 +
                        direction TINYINT,
 +
                        qos_qdiscs_id INT NOT NULL,
 +
                        PRIMARY KEY (id)
 +
        );
 +
 +
        ALTER TABLE qos_classes MODIFY COLUMN classid INTEGER COMMENT 'd it must be de';
 +
 +
 +
        CREATE INDEX fk_qos_classes_qos_qdiscs1 USING BTREE
 +
        ON qos_classes
 +
        ( qos_qdiscs_id ASC );
 +
 +
        CREATE TABLE subnets_has_qos_classes (
 +
                        subnets_id INT NOT NULL,
 +
                        qos_classes_id INT NOT NULL,
 +
                        PRIMARY KEY (subnets_id, qos_classes_id)
 +
        );
 +
 +
 +
        CREATE INDEX fk_subnets_has_qos_classes_qos_classes1 USING BTREE
 +
        ON subnets_has_qos_classes
 +
        ( qos_classes_id ASC );
 +
 +
        CREATE TABLE qos_filters (
 +
                        id INT AUTO_INCREMENT NOT NULL,
 +
                        filterid INT,
 +
                        priority INT,
 +
                        qos_hash_tables_id INT NOT NULL,
 +
                        qos_classes_id INT NOT NULL,
 +
                        PRIMARY KEY (id)
 +
        );
 +
 +
 +
        CREATE INDEX fk_qos_filters_qos_hash_tables1 USING BTREE
 +
        ON qos_filters
 +
        ( qos_hash_tables_id ASC );
 +
 +
        CREATE INDEX fk_qos_filters_qos_classes1 USING BTREE
 +
        ON qos_filters
 +
        ( qos_classes_id ASC );
 +
 +
        CREATE TABLE members_has_qos_classes (
 +
                        members_id INT NOT NULL,
 +
                        qos_classes_id INT NOT NULL,
 +
                        PRIMARY KEY (members_id, qos_classes_id)
 +
        );
 +
 +
 +
        CREATE INDEX fk_members_has_qos_classes_qos_classes1 USING BTREE
 +
        ON members_has_qos_classes
 +
        ( qos_classes_id ASC );
 +
 +
        CREATE TABLE ip_addresses_has_qos_classes (
 +
                        ip_addresses_id INT NOT NULL,
 +
                        qos_classes_id INT NOT NULL,
 +
                        PRIMARY KEY (ip_addresses_id, qos_classes_id)
 +
        );
 +
 +
 +
        CREATE INDEX fk_ip_addresses_has_qos_classes_qos_classes1 USING BTREE
 +
        ON ip_addresses_has_qos_classes
 +
        ( qos_classes_id ASC );
 +
 +
        ALTER TABLE subnets_has_qos_classes ADD CONSTRAINT fk_subnets_has_classes_subnets1
 +
        FOREIGN KEY (subnets_id)
 +
        REFERENCES subnets (id)
 +
        ON DELETE NO ACTION
 +
        ON UPDATE NO ACTION;
 +
 +
        ALTER TABLE members_has_qos_classes ADD CONSTRAINT fk_members_has_qos_classes_members1
 +
        FOREIGN KEY (members_id)
 +
        REFERENCES members (id)
 +
        ON DELETE NO ACTION
 +
        ON UPDATE NO ACTION;
 +
 +
        ALTER TABLE ip_addresses_has_qos_classes ADD CONSTRAINT fk_ip_addresses_have_classes_ip_addresses1
 +
        FOREIGN KEY (ip_addresses_id)
 +
        REFERENCES ip_addresses (id)
 +
        ON DELETE NO ACTION
 +
        ON UPDATE NO ACTION;
 +
 +
        ALTER TABLE qos_qdiscs ADD CONSTRAINT fk_qdiscs_ifaces
 +
        FOREIGN KEY (interface_id)
 +
        REFERENCES interfaces (id)
 +
        ON DELETE NO ACTION
 +
        ON UPDATE NO ACTION;
 +
 +
        ALTER TABLE qos_classes ADD CONSTRAINT fk_classes_qdiscs1
 +
        FOREIGN KEY (id)
 +
        REFERENCES qos_qdiscs (id)
 +
        ON DELETE NO ACTION
 +
        ON UPDATE NO ACTION;
 +
 +
        ALTER TABLE qos_hash_tables ADD CONSTRAINT fk_hash_tables_qdiscs1
 +
        FOREIGN KEY (id)
 +
        REFERENCES qos_qdiscs (id)
 +
        ON DELETE NO ACTION
 +
        ON UPDATE NO ACTION;
 +
 +
        ALTER TABLE qos_qdiscs ADD CONSTRAINT fk_qdiscs_qdiscs1
 +
        FOREIGN KEY (Parent_id)
 +
        REFERENCES qos_qdiscs (id)
 +
        ON DELETE NO ACTION
 +
        ON UPDATE NO ACTION;
 +
 +
        ALTER TABLE qos_filters ADD CONSTRAINT fk_filters_hash_tables1
 +
        FOREIGN KEY (qos_hash_tables_id)
 +
        REFERENCES qos_hash_tables (id)
 +
        ON DELETE NO ACTION
 +
        ON UPDATE NO ACTION;
 +
 +
        ALTER TABLE ip_addresses_has_qos_classes ADD CONSTRAINT fk_ip_addresses_has_classes_classes1
 +
        FOREIGN KEY (qos_classes_id)
 +
        REFERENCES qos_classes (id)
 +
        ON DELETE NO ACTION
 +
        ON UPDATE NO ACTION;
 +
 +
        ALTER TABLE members_has_qos_classes ADD CONSTRAINT fk_members_has_classes_classes1
 +
        FOREIGN KEY (qos_classes_id)
 +
        REFERENCES qos_classes (id)
 +
        ON DELETE NO ACTION
 +
        ON UPDATE NO ACTION;
 +
 +
        ALTER TABLE qos_filters ADD CONSTRAINT fk_filters_classes1
 +
        FOREIGN KEY (qos_classes_id)
 +
        REFERENCES qos_classes (id)
 +
        ON DELETE NO ACTION
 +
        ON UPDATE NO ACTION;
 +
 +
        ALTER TABLE subnets_has_qos_classes ADD CONSTRAINT fk_subnets_has_classes_classes1
 +
        FOREIGN KEY (qos_classes_id)
 +
        REFERENCES qos_classes (id)
 +
        ON DELETE NO ACTION
 +
        ON UPDATE NO ACTION;

Verze z 22. 10. 2010, 20:56

Schema je na obrázku níže: Linux qos db schema.png

Pro pochopení schematu je vhodné podívat se nejdřív na prezentaci o Linux QoS a U32 hashtables:

SDL - SQL

       CREATE TABLE qos_qdiscs (
                       id INT AUTO_INCREMENT NOT NULL,
                       qos_qdisc_parent_id INT NOT NULL,
                       interface_id INT NOT NULL,
                       qdisc_id INT,
                       Parent_id INT NOT NULL,
                       PRIMARY KEY (id)
       );


       CREATE INDEX fk_qos_qdiscs_qos_qdiscs1 USING BTREE
        ON qos_qdiscs
        ( qos_qdisc_parent_id ASC );
       CREATE INDEX fk_qos_qdiscs_devices1 USING BTREE
        ON qos_qdiscs
        ( interface_id ASC );
       CREATE TABLE qos_hash_tables (
                       id INT AUTO_INCREMENT NOT NULL,
                       htid INT,
                       buckets INT,
                       qos_qdiscs_id INT NOT NULL,
                       PRIMARY KEY (id)
       );


       CREATE INDEX fk_qos_hash_tables_qos_qdiscs1 USING BTREE
        ON qos_hash_tables
        ( qos_qdiscs_id ASC );
       CREATE TABLE qos_classes (
                       id INT AUTO_INCREMENT NOT NULL,
                       rate INT,
                       ceil INT,
                       classid INT,
                       direction TINYINT,
                       qos_qdiscs_id INT NOT NULL,
                       PRIMARY KEY (id)
       );
       ALTER TABLE qos_classes MODIFY COLUMN classid INTEGER COMMENT 'd it must be de';


       CREATE INDEX fk_qos_classes_qos_qdiscs1 USING BTREE
        ON qos_classes
        ( qos_qdiscs_id ASC );
       CREATE TABLE subnets_has_qos_classes (
                       subnets_id INT NOT NULL,
                       qos_classes_id INT NOT NULL,
                       PRIMARY KEY (subnets_id, qos_classes_id)
       );


       CREATE INDEX fk_subnets_has_qos_classes_qos_classes1 USING BTREE
        ON subnets_has_qos_classes
        ( qos_classes_id ASC );
       CREATE TABLE qos_filters (
                       id INT AUTO_INCREMENT NOT NULL,
                       filterid INT,
                       priority INT,
                       qos_hash_tables_id INT NOT NULL,
                       qos_classes_id INT NOT NULL,
                       PRIMARY KEY (id)
       );


       CREATE INDEX fk_qos_filters_qos_hash_tables1 USING BTREE
        ON qos_filters
        ( qos_hash_tables_id ASC );
       CREATE INDEX fk_qos_filters_qos_classes1 USING BTREE
        ON qos_filters
        ( qos_classes_id ASC );
       CREATE TABLE members_has_qos_classes (
                       members_id INT NOT NULL,
                       qos_classes_id INT NOT NULL,
                       PRIMARY KEY (members_id, qos_classes_id)
       );


       CREATE INDEX fk_members_has_qos_classes_qos_classes1 USING BTREE
        ON members_has_qos_classes
        ( qos_classes_id ASC );
       CREATE TABLE ip_addresses_has_qos_classes (
                       ip_addresses_id INT NOT NULL,
                       qos_classes_id INT NOT NULL,
                       PRIMARY KEY (ip_addresses_id, qos_classes_id)
       );


       CREATE INDEX fk_ip_addresses_has_qos_classes_qos_classes1 USING BTREE
        ON ip_addresses_has_qos_classes
        ( qos_classes_id ASC );
       ALTER TABLE subnets_has_qos_classes ADD CONSTRAINT fk_subnets_has_classes_subnets1
       FOREIGN KEY (subnets_id)
       REFERENCES subnets (id)
       ON DELETE NO ACTION
       ON UPDATE NO ACTION;
       ALTER TABLE members_has_qos_classes ADD CONSTRAINT fk_members_has_qos_classes_members1
       FOREIGN KEY (members_id)
       REFERENCES members (id)
       ON DELETE NO ACTION
       ON UPDATE NO ACTION;
       ALTER TABLE ip_addresses_has_qos_classes ADD CONSTRAINT fk_ip_addresses_have_classes_ip_addresses1
       FOREIGN KEY (ip_addresses_id)
       REFERENCES ip_addresses (id)
       ON DELETE NO ACTION
       ON UPDATE NO ACTION;
       ALTER TABLE qos_qdiscs ADD CONSTRAINT fk_qdiscs_ifaces
       FOREIGN KEY (interface_id)
       REFERENCES interfaces (id)
       ON DELETE NO ACTION
       ON UPDATE NO ACTION;
       ALTER TABLE qos_classes ADD CONSTRAINT fk_classes_qdiscs1
       FOREIGN KEY (id)
       REFERENCES qos_qdiscs (id)
       ON DELETE NO ACTION
       ON UPDATE NO ACTION;
       ALTER TABLE qos_hash_tables ADD CONSTRAINT fk_hash_tables_qdiscs1
       FOREIGN KEY (id)
       REFERENCES qos_qdiscs (id)
       ON DELETE NO ACTION
       ON UPDATE NO ACTION;
       ALTER TABLE qos_qdiscs ADD CONSTRAINT fk_qdiscs_qdiscs1
       FOREIGN KEY (Parent_id)
       REFERENCES qos_qdiscs (id)
       ON DELETE NO ACTION
       ON UPDATE NO ACTION;
       ALTER TABLE qos_filters ADD CONSTRAINT fk_filters_hash_tables1
       FOREIGN KEY (qos_hash_tables_id)
       REFERENCES qos_hash_tables (id)
       ON DELETE NO ACTION
       ON UPDATE NO ACTION;
       ALTER TABLE ip_addresses_has_qos_classes ADD CONSTRAINT fk_ip_addresses_has_classes_classes1
       FOREIGN KEY (qos_classes_id)
       REFERENCES qos_classes (id)
       ON DELETE NO ACTION
       ON UPDATE NO ACTION;
       ALTER TABLE members_has_qos_classes ADD CONSTRAINT fk_members_has_classes_classes1
       FOREIGN KEY (qos_classes_id)
       REFERENCES qos_classes (id)
       ON DELETE NO ACTION
       ON UPDATE NO ACTION;
       ALTER TABLE qos_filters ADD CONSTRAINT fk_filters_classes1
       FOREIGN KEY (qos_classes_id)
       REFERENCES qos_classes (id)
       ON DELETE NO ACTION
       ON UPDATE NO ACTION;
       ALTER TABLE subnets_has_qos_classes ADD CONSTRAINT fk_subnets_has_classes_classes1
       FOREIGN KEY (qos_classes_id)
       REFERENCES qos_classes (id)
       ON DELETE NO ACTION
       ON UPDATE NO ACTION;