bae4c820ee
* Initial Webserver Draft for Version Controlling * Rename type to avoid confusion * Move Function Calls into Version Package * Fix Linting and Language Typos * Fix Linting and Spelling Mistakes * Include Copyright * Include Copyright * Adjust Version-Control Server to return list of Versions * Linting * Improve Request Handling and Readability * Add Configuration File Option Add Systemd Service file * Add Logging to File * Smaller Changes * Add Semantic Versioning and refuses outdated Software from Startup (#1612) * implements internal Semantic Version library * adds version logging + reporting to process * Advance SemVer struct for easier handling * Add Accepted Version Store * Fix Function * Restructure * Type Conversion * Handle Version String properly * Add Note about array index * Set temporary Default Version * Add Copyright * Adding Version to Dashboard * Adding Version Info Log * Renaming and adding CheckerProcess * Iteration Sync * Iteration V2 * linting * made LogAndReportVersion a go routine * Refactor to Go Routine * Add Context to Go Routine and allow Operation if Lookup to Control Server fails * Handle Unmarshal properly * Linting * Relocate Version Checks * Relocating Version Check and specified default Version for now * Linting Error Prevention * Refuse Startup on outdated Version * Add Startup Check Function * Straighten Logging * Dont force Shutdown if --dev flag is set * Create full Service/Peer Structure for ControlServer * Linting * Straighting Naming * Finish VersionControl Service Layout * Improve Error Handling * Change Listening Address * Move Checker Function * Remove VersionControl Peer * Linting * Linting * Create VersionClient Service * Renaming * Add Version Client to Peer Definitions * Linting and Renaming * Linting * Remove Transport Checks for now * Move to Client Side Flag * Remove check * Linting * Transport Client Version Intro * Adding Version Client to Transport Client * Add missing parameter * Adding Version Check, to set Allowed = true * Set Default to true, testing * Restructuring Code * Uplink Changes * Add more proper Defaults * Renaming of Version struct * Dont pass Service use Pointer * Set Defaults for Versioning Checks * Put HTTP Server in go routine * Add Versioncontrol to Storj-Sim * Testplanet Fixes * Linting * Add Error Handling and new Server Struct * Move Lock slightly * Reduce Race Potentials * Remove unnecessary files * Linting * Add Proper Transport Handling * small fixes * add fence for allowed check * Add Startup Version Check and Service Naming * make errormessage private * Add Comments about VersionedClient * Linting * Remove Checks that refuse outgoing connections * Remove release cmd * Add Release Script * Linting * Update to use correct Values * Change Timestamp handling * Adding Protobuf changes back in * Adding SatelliteDB Changes and adding Storj Node Version to PB * Add Migration Table * Add Default Stats for Creation * Move to BigInt * Proper SQL Migration * Ensure minimum Version is passed to the node selection * Linting... * Remove VersionedClient and adjust smaller changes from prior merge * Linting * Fix PB Message Handling and Query for Node Selection * some future-proofing type changes Change-Id: I3cb5018dcccdbc9739fe004d859065992720caaf * fix a compiler error Change-Id: If66bb92d8b98e31cd618ecec9c6448ab9b037fa5 * Comment on Constant for Overlay * Remove NOT NULL and add epoch call as function * add versions to bootstrap and satellites Change-Id: I436944589ea5f21600cdd997742a84fe0b16e47b * Change Update Migration * Fix DB Migration * Increase Timeout temporarily, to see whats going on * Remove unnecessary const and vars Cleanup Function calls from deprecated NodeVersion struct * Updated Protopuf, removed depcreated Code from Inspector * Implement NodeVersion into InfoResponse * Regenerated locked.go * Linting * Fix Tests * Remove unnecessary constant * Update Function and Flag Description * Remove Empty Stat Creation * return properly with error * Remove unnecessary struct * simplify migration step * Update Inspector to return Version Info * Update local Endpoint Version Handling * Reset Travis Timeout * Add Default for CommitHash * single quotes
545 lines
12 KiB
Plaintext
545 lines
12 KiB
Plaintext
// dbx.v1 golang satellitedb.dbx .
|
|
|
|
//--- bwagreement ---//
|
|
|
|
model bwagreement (
|
|
key serialnum
|
|
|
|
field serialnum text
|
|
field storage_node_id blob
|
|
field uplink_id blob
|
|
field action int64
|
|
field total int64
|
|
field created_at timestamp ( autoinsert )
|
|
field expires_at timestamp
|
|
)
|
|
|
|
|
|
//--- irreparableDB ---//
|
|
|
|
model irreparabledb (
|
|
key segmentpath
|
|
|
|
field segmentpath blob
|
|
field segmentdetail blob ( updatable )
|
|
field pieces_lost_count int64 ( updatable )
|
|
field seg_damaged_unix_sec int64 ( updatable )
|
|
field repair_attempt_count int64 ( updatable )
|
|
)
|
|
|
|
create irreparabledb ( )
|
|
update irreparabledb ( where irreparabledb.segmentpath = ? )
|
|
delete irreparabledb ( where irreparabledb.segmentpath = ? )
|
|
|
|
read one (
|
|
select irreparabledb
|
|
where irreparabledb.segmentpath = ?
|
|
)
|
|
|
|
read limitoffset (
|
|
select irreparabledb
|
|
orderby asc irreparabledb.segmentpath
|
|
)
|
|
|
|
//--- accounting ---//
|
|
|
|
// accounting_timestamps just allows us to save the last time/thing that happened
|
|
model accounting_timestamps (
|
|
key name
|
|
|
|
field name text
|
|
field value timestamp ( updatable )
|
|
)
|
|
|
|
create accounting_timestamps ( )
|
|
update accounting_timestamps ( where accounting_timestamps.name = ? )
|
|
|
|
read scalar (
|
|
select accounting_timestamps.value
|
|
where accounting_timestamps.name = ?
|
|
)
|
|
|
|
model accounting_rollup (
|
|
key id
|
|
|
|
field id serial64
|
|
field node_id blob
|
|
field start_time timestamp
|
|
field put_total int64
|
|
field get_total int64
|
|
field get_audit_total int64
|
|
field get_repair_total int64
|
|
field put_repair_total int64
|
|
field at_rest_total float64
|
|
)
|
|
|
|
create accounting_rollup ( )
|
|
delete accounting_rollup ( where accounting_rollup.id = ? )
|
|
|
|
read one (
|
|
select accounting_rollup
|
|
where accounting_rollup.id = ?
|
|
)
|
|
|
|
read all (
|
|
select accounting_rollup
|
|
where accounting_rollup.start_time >= ?
|
|
)
|
|
|
|
model accounting_raw (
|
|
key id
|
|
|
|
field id serial64
|
|
field node_id blob
|
|
field interval_end_time timestamp
|
|
field data_total float64
|
|
field data_type int
|
|
field created_at timestamp
|
|
)
|
|
|
|
create accounting_raw ( )
|
|
delete accounting_raw ( where accounting_raw.id = ? )
|
|
|
|
read one (
|
|
select accounting_raw
|
|
where accounting_raw.id = ?
|
|
)
|
|
|
|
read all (
|
|
select accounting_raw
|
|
)
|
|
|
|
read all (
|
|
select accounting_raw
|
|
where accounting_raw.interval_end_time >= ?
|
|
)
|
|
|
|
//--- statdb ---//
|
|
|
|
model node (
|
|
key id
|
|
|
|
field id blob
|
|
field address text ( updatable ) // TODO: use compressed format
|
|
field protocol int ( updatable )
|
|
field type int ( updatable )
|
|
field email text ( updatable )
|
|
field wallet text ( updatable ) // TODO: use compressed format
|
|
field free_bandwidth int64 ( updatable )
|
|
field free_disk int64 ( updatable )
|
|
|
|
field major int64 ( updatable )
|
|
field minor int64 ( updatable )
|
|
field patch int64 ( updatable )
|
|
field hash text ( updatable )
|
|
field timestamp timestamp ( updatable )
|
|
field release bool ( updatable )
|
|
|
|
field latency_90 int64 ( updatable )
|
|
field audit_success_count int64 ( updatable )
|
|
field total_audit_count int64 ( updatable )
|
|
field audit_success_ratio float64 ( updatable )
|
|
field uptime_success_count int64 ( updatable )
|
|
field total_uptime_count int64 ( updatable )
|
|
field uptime_ratio float64 ( updatable )
|
|
|
|
field created_at timestamp ( autoinsert )
|
|
field updated_at timestamp ( autoinsert, autoupdate )
|
|
field last_contact_success timestamp ( updatable )
|
|
field last_contact_failure timestamp ( updatable )
|
|
)
|
|
|
|
create node ( )
|
|
update node ( where node.id = ? )
|
|
delete node ( where node.id = ? )
|
|
|
|
// "Get" query; fails if node not found
|
|
read one (
|
|
select node
|
|
where node.id = ?
|
|
)
|
|
|
|
read all (
|
|
select node.id
|
|
)
|
|
|
|
read limitoffset (
|
|
select node
|
|
where node.id >= ?
|
|
orderby asc node.id
|
|
)
|
|
|
|
//--- repairqueue ---//
|
|
|
|
model injuredsegment (
|
|
key id
|
|
|
|
field id serial64
|
|
field info blob
|
|
)
|
|
|
|
create injuredsegment ( )
|
|
|
|
read first (
|
|
select injuredsegment
|
|
)
|
|
|
|
read limitoffset (
|
|
select injuredsegment
|
|
)
|
|
delete injuredsegment ( where injuredsegment.id = ? )
|
|
|
|
//--- satellite console ---//
|
|
|
|
model user (
|
|
key id
|
|
|
|
field id blob
|
|
field full_name text ( updatable )
|
|
field short_name text ( updatable, nullable )
|
|
|
|
field email text ( updatable )
|
|
field password_hash blob ( updatable )
|
|
|
|
field status int ( updatable, autoinsert )
|
|
|
|
field created_at timestamp ( autoinsert )
|
|
)
|
|
read one (
|
|
select user
|
|
where user.email = ?
|
|
where user.status != 0
|
|
)
|
|
read one (
|
|
select user
|
|
where user.id = ?
|
|
)
|
|
create user ( )
|
|
update user ( where user.id = ? )
|
|
delete user ( where user.id = ? )
|
|
|
|
|
|
model project (
|
|
key id
|
|
|
|
field id blob
|
|
|
|
field name text
|
|
field description text ( updatable )
|
|
|
|
field created_at timestamp ( autoinsert )
|
|
)
|
|
read all ( select project)
|
|
read one (
|
|
select project
|
|
where project.id = ?
|
|
)
|
|
read all (
|
|
select project
|
|
join project.id = project_member.project_id
|
|
where project_member.member_id = ?
|
|
orderby asc project.name
|
|
)
|
|
create project ( )
|
|
update project ( where project.id = ? )
|
|
delete project ( where project.id = ? )
|
|
|
|
|
|
model project_member (
|
|
key member_id project_id
|
|
|
|
field member_id user.id cascade
|
|
field project_id project.id cascade
|
|
|
|
field created_at timestamp ( autoinsert )
|
|
)
|
|
|
|
read all (
|
|
select project_member
|
|
where project_member.member_id = ?
|
|
)
|
|
read limitoffset (
|
|
select project_member
|
|
where project_member.project_id = ?
|
|
)
|
|
create project_member ( )
|
|
delete project_member (
|
|
where project_member.member_id = ?
|
|
where project_member.project_id = ?
|
|
)
|
|
|
|
model api_key (
|
|
key id
|
|
unique key
|
|
unique name project_id
|
|
|
|
field id blob
|
|
field project_id project.id cascade
|
|
|
|
field key blob
|
|
|
|
field name text (updatable)
|
|
|
|
field created_at timestamp (autoinsert)
|
|
)
|
|
|
|
create api_key ()
|
|
update api_key ( where api_key.id = ? )
|
|
delete api_key ( where api_key.id = ? )
|
|
|
|
read one (
|
|
select api_key
|
|
where api_key.id = ?
|
|
)
|
|
read one (
|
|
select api_key
|
|
where api_key.key = ?
|
|
)
|
|
read all (
|
|
select api_key
|
|
where api_key.project_id = ?
|
|
orderby asc api_key.name
|
|
)
|
|
|
|
//-----bucket_usage----//
|
|
|
|
model bucket_usage (
|
|
key id
|
|
index (
|
|
name bucket_id_rollup
|
|
fields bucket_id rollup_end_time
|
|
unique
|
|
)
|
|
|
|
field id blob
|
|
field bucket_id blob //--TODO: add foreign key constraint--//
|
|
|
|
field rollup_end_time timestamp
|
|
|
|
field remote_stored_data uint64
|
|
field inline_stored_data uint64
|
|
field remote_segments uint
|
|
field inline_segments uint
|
|
field objects uint
|
|
field metadata_size uint64
|
|
field repair_egress uint64
|
|
field get_egress uint64
|
|
field audit_egress uint64
|
|
)
|
|
|
|
create bucket_usage ()
|
|
delete bucket_usage ( where bucket_usage.id = ? )
|
|
|
|
read one (
|
|
select bucket_usage
|
|
where bucket_usage.id = ?
|
|
)
|
|
|
|
read limitoffset (
|
|
select bucket_usage
|
|
where bucket_usage.bucket_id = ?
|
|
where bucket_usage.rollup_end_time > ?
|
|
where bucket_usage.rollup_end_time <= ?
|
|
orderby asc bucket_usage.rollup_end_time
|
|
)
|
|
|
|
read limitoffset (
|
|
select bucket_usage
|
|
where bucket_usage.bucket_id = ?
|
|
where bucket_usage.rollup_end_time > ?
|
|
where bucket_usage.rollup_end_time <= ?
|
|
orderby desc bucket_usage.rollup_end_time
|
|
)
|
|
|
|
//--- tracking serial numbers ---//
|
|
|
|
model serial_number (
|
|
key id
|
|
index (
|
|
name serial_number
|
|
fields serial_number
|
|
unique
|
|
)
|
|
|
|
field id serial
|
|
field serial_number blob
|
|
|
|
field bucket_id blob
|
|
field expires_at utimestamp
|
|
|
|
index (
|
|
fields expires_at
|
|
)
|
|
)
|
|
|
|
model used_serial (
|
|
key serial_number_id storage_node_id
|
|
|
|
field serial_number_id serial_number.id cascade
|
|
field storage_node_id blob
|
|
)
|
|
|
|
// inserting a new serial number
|
|
create serial_number ()
|
|
|
|
// finding out information about the serial number
|
|
read scalar (
|
|
select serial_number
|
|
where serial_number.serial_number = ?
|
|
)
|
|
|
|
// deleting expired serial numbers
|
|
delete serial_number (
|
|
where serial_number.expires_at <= ?
|
|
)
|
|
|
|
// for preventing duplicate serial numbers
|
|
create used_serial ()
|
|
|
|
// --- bucket accounting tables --- //
|
|
|
|
model bucket_bandwidth_rollup (
|
|
key bucket_name project_id interval_start action
|
|
index (
|
|
name bucket_name_project_id_interval_start_interval_seconds
|
|
fields bucket_name project_id interval_start interval_seconds
|
|
)
|
|
|
|
field bucket_name blob
|
|
field project_id blob
|
|
|
|
field interval_start utimestamp
|
|
field interval_seconds uint
|
|
field action uint
|
|
|
|
field inline uint64 ( updatable )
|
|
field allocated uint64 ( updatable )
|
|
field settled uint64 ( updatable )
|
|
)
|
|
|
|
read scalar (
|
|
select bucket_bandwidth_rollup
|
|
where bucket_bandwidth_rollup.bucket_name = ?
|
|
where bucket_bandwidth_rollup.project_id = ?
|
|
where bucket_bandwidth_rollup.interval_start = ?
|
|
where bucket_bandwidth_rollup.action = ?
|
|
)
|
|
|
|
model bucket_storage_tally (
|
|
key bucket_name project_id interval_start
|
|
|
|
field bucket_name blob
|
|
field project_id blob
|
|
|
|
field interval_start utimestamp
|
|
|
|
field inline uint64
|
|
field remote uint64
|
|
|
|
field remote_segments_count uint
|
|
field inline_segments_count uint
|
|
field object_count uint
|
|
|
|
field metadata_size uint64
|
|
)
|
|
|
|
create bucket_storage_tally ()
|
|
|
|
read first (
|
|
select bucket_storage_tally
|
|
where bucket_storage_tally.project_id = ?
|
|
orderby desc bucket_storage_tally.interval_start
|
|
)
|
|
|
|
read all (
|
|
select bucket_storage_tally
|
|
where bucket_storage_tally.project_id = ?
|
|
where bucket_storage_tally.bucket_name = ?
|
|
where bucket_storage_tally.interval_start >= ?
|
|
where bucket_storage_tally.interval_start <= ?
|
|
orderby desc bucket_storage_tally.interval_start
|
|
)
|
|
|
|
// --- storage node accounting tables --- //
|
|
|
|
model storagenode_bandwidth_rollup (
|
|
key storagenode_id interval_start action
|
|
index (
|
|
name storagenode_id_interval_start_interval_seconds
|
|
fields storagenode_id interval_start interval_seconds
|
|
)
|
|
|
|
field storagenode_id blob
|
|
field interval_start utimestamp
|
|
field interval_seconds uint
|
|
field action uint
|
|
|
|
field allocated uint64 ( updatable )
|
|
field settled uint64 ( updatable )
|
|
)
|
|
|
|
read scalar (
|
|
select storagenode_bandwidth_rollup
|
|
where storagenode_bandwidth_rollup.storagenode_id = ?
|
|
where storagenode_bandwidth_rollup.interval_start = ?
|
|
where storagenode_bandwidth_rollup.action = ?
|
|
)
|
|
|
|
read all (
|
|
select storagenode_bandwidth_rollup
|
|
where storagenode_bandwidth_rollup.interval_start >= ?
|
|
)
|
|
|
|
model storagenode_storage_tally (
|
|
key storagenode_id interval_start
|
|
|
|
field storagenode_id blob
|
|
field interval_start utimestamp
|
|
|
|
field total uint64
|
|
)
|
|
|
|
//--- certRecord ---//
|
|
|
|
model certRecord (
|
|
key id
|
|
|
|
field publickey blob //--uplink public key--//
|
|
field id blob //--uplink node id --//
|
|
field update_at timestamp ( autoinsert, autoupdate )
|
|
)
|
|
|
|
create certRecord ( )
|
|
delete certRecord ( where certRecord.id = ? )
|
|
update certRecord ( where certRecord.id = ? )
|
|
|
|
read one (
|
|
select certRecord
|
|
where certRecord.id = ?
|
|
)
|
|
|
|
//--- satellite registration token for Vanguard release (temporary table) ---//
|
|
|
|
model registration_token (
|
|
key secret
|
|
unique owner_id
|
|
|
|
field secret blob
|
|
field owner_id blob ( updatable, nullable )
|
|
|
|
field project_limit int
|
|
|
|
field created_at timestamp ( autoinsert )
|
|
)
|
|
|
|
create registration_token ( )
|
|
read one (
|
|
select registration_token
|
|
where registration_token.secret = ?
|
|
)
|
|
read one (
|
|
select registration_token
|
|
where registration_token.owner_id = ?
|
|
)
|
|
update registration_token ( where registration_token.secret = ? )
|