forked from apache/cloudstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudbridge_schema.sql
More file actions
162 lines (116 loc) · 4.36 KB
/
cloudbridge_schema.sql
File metadata and controls
162 lines (116 loc) · 4.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
USE cloudbridge;
SET foreign_key_checks = 0;
DROP TABLE IF EXISTS shost;
DROP TABLE IF EXISTS mhost;
DROP TABLE IF EXISTS mhost_mount;
DROP TABLE IF EXISTS sbucket;
DROP TABLE IF EXISTS sobject;
DROP TABLE IF EXISTS sobject_item;
DROP TABLE IF EXISTS meta;
DROP TABLE IF EXISTS acl;
DROP TABLE IF EXISTS usercredentials;
-- storage host
CREATE TABLE shost (
ID BIGINT NOT NULL AUTO_INCREMENT,
Host VARCHAR(128) NOT NULL,
HostType INT NOT NULL DEFAULT 0, -- 0 : local, 1 : nfs
ExportRoot VARCHAR(128) NOT NULL,
MHostID BIGINT, -- when host type is local, MHostID points to its owner management host
UserOnHost VARCHAR(64),
UserPassword VARCHAR(128),
PRIMARY KEY(ID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- management host
CREATE TABLE mhost (
ID BIGINT NOT NULL AUTO_INCREMENT,
MHostKey VARCHAR(128) NOT NULL, -- host key could be derived from MAC address or named configuration value
Host VARCHAR(128), -- public host address for redirecting request from/to
Version VARCHAR(64),
LastHeartbeatTime DATETIME,
PRIMARY KEY(ID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE mhost_mount (
ID BIGINT NOT NULL AUTO_INCREMENT,
MHostID BIGINT NOT NULL,
SHostID BIGINT NOT NULL,
MountPath VARCHAR(256), -- local mount path
LastMountTime DATETIME, -- null : unmounted, otherwise the mount location
PRIMARY KEY(ID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE sbucket (
ID BIGINT NOT NULL AUTO_INCREMENT,
Name VARCHAR(64) NOT NULL,
OwnerCanonicalID VARCHAR(150) NOT NULL,
SHostID BIGINT,
CreateTime DATETIME,
VersioningStatus INT NOT NULL DEFAULT 0, -- 0 : initial not set, 1 : enabled, 2 : suspended
PRIMARY KEY(ID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE sobject (
ID BIGINT NOT NULL AUTO_INCREMENT,
SBucketID BIGINT NOT NULL,
NameKey VARCHAR(255) NOT NULL,
OwnerCanonicalID VARCHAR(150) NOT NULL,
NextSequence INT NOT NULL DEFAULT 1,
DeletionMark VARCHAR (150),
CreateTime DATETIME,
PRIMARY KEY(ID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE sobject_item (
ID BIGINT NOT NULL AUTO_INCREMENT,
SObjectID BIGINT NOT NULL,
Version VARCHAR(64),
MD5 VARCHAR(128),
StoredPath VARCHAR(256), -- relative to mount point of the root
StoredSize BIGINT NOT NULL DEFAULT 0,
CreateTime DATETIME,
LastModifiedTime DATETIME,
LastAccessTime DATETIME,
PRIMARY KEY(ID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE meta (
ID BIGINT NOT NULL AUTO_INCREMENT,
Target VARCHAR(64) NOT NULL,
TargetID BIGINT NOT NULL,
Name VARCHAR(64) NOT NULL,
Value VARCHAR(256),
PRIMARY KEY(ID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE acl (
ID BIGINT NOT NULL AUTO_INCREMENT,
Target VARCHAR(64) NOT NULL,
TargetID BIGINT NOT NULL,
GranteeType INT NOT NULL DEFAULT 0, -- 0 : Cloud service user, 1 : Cloud user community, 2: Public user community
GranteeCanonicalID VARCHAR(150), -- make it big enought to hold a Cloud API access key
Permission INT NOT NULL DEFAULT 0, -- 0 : no permission, 1 : read, 2 : write, 4 : read_acl, 8 : write_acl
GrantOrder INT NOT NULL DEFAULT 0,
CreateTime DATETIME,
LastModifiedTime DATETIME,
PRIMARY KEY(ID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- each account has to have a separate <AccessKey,SecretKey>
-- each account has to have a separate <CertUniqueID,AccessKey> mappings
CREATE TABLE usercredentials (
ID BIGINT NOT NULL AUTO_INCREMENT,
AccessKey VARCHAR(150) NOT NULL,
SecretKey VARCHAR(150) NOT NULL,
CertUniqueId VARCHAR(200),
PRIMARY KEY(ID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET foreign_key_checks = 1;