From 886041e0bac293c5ed5a2024e6268ca9bd5a4b82 Mon Sep 17 00:00:00 2001 From: Ethan Adams Date: Fri, 13 Sep 2019 12:57:32 -0400 Subject: [PATCH] satellite/satellitedb: add new graceful exit tables and add graceful exit fields to nodes (#3033) DB schema changes for satellite to support Graceful Exit --- .../storagenode-graceful-exit/overview.md | 2 +- .../storagenode-graceful-exit/pieces.md | 6 +- satellite/satellitedb/dbx/satellitedb.dbx | 64 + satellite/satellitedb/dbx/satellitedb.dbx.go | 1402 ++++++++++++++++- .../dbx/satellitedb.dbx.postgres.sql | 22 + .../dbx/satellitedb.dbx.sqlite3.sql | 22 + satellite/satellitedb/migrate.go | 29 + .../satellitedb/testdata/postgres.v56.sql | 407 +++++ 8 files changed, 1929 insertions(+), 25 deletions(-) create mode 100644 satellite/satellitedb/testdata/postgres.v56.sql diff --git a/docs/blueprints/storagenode-graceful-exit/overview.md b/docs/blueprints/storagenode-graceful-exit/overview.md index df6fcc457..01cca9d62 100644 --- a/docs/blueprints/storagenode-graceful-exit/overview.md +++ b/docs/blueprints/storagenode-graceful-exit/overview.md @@ -104,7 +104,7 @@ Update `nodes` table: ``` model nodes ( ... - field exit_loop_completed timestamp ( updateable ) + field exit_loop_completed_at timestamp ( updateable ) field exit_initiated_at timestamp ( updateable ) field exit_finished_at timestamp ( updateable ) } diff --git a/docs/blueprints/storagenode-graceful-exit/pieces.md b/docs/blueprints/storagenode-graceful-exit/pieces.md index 3b79ac6e2..f32624f2d 100644 --- a/docs/blueprints/storagenode-graceful-exit/pieces.md +++ b/docs/blueprints/storagenode-graceful-exit/pieces.md @@ -16,16 +16,16 @@ Pieces with lower durability have higher importance to be transferred. We need a service on the satellite that finds pieces in the metainfo database that need to be transferred. We'll call this service `gexit.Service` or Graceful Exit service. -The service starts by asking overlay for all exiting nodes where `nodes.exit_loop_completed` is null. +The service starts by asking overlay for all exiting nodes where `nodes.exit_loop_completed_at` is null. Then joins a metainfo loop to iterate over all segments. For any segment that contains nodes that are exiting it will add an entry to a queue (if durability <= optimal). We call this the transfer queue. If durability > optimal, we remove the exiting node from the segment / pointer. The transfer queue is stored in database. We will need batching when inserting to database to avoid excessive load. -Once metainfo loop has completed successfully it updates `nodes.exit_loop_completed` with the current timestamp to indicate the storage nodes is ready for transferring. +Once metainfo loop has completed successfully it updates `nodes.exit_loop_completed_at` with the current timestamp to indicate the storage nodes is ready for transferring. -In the event that the satellite does not complete the metainfo loop (e.g. satellite is shutdown), the service will re-enter the metainfo loop for all exiting nodes where `nodes.exit_loop_completed` is null. Pieces that already exist in the queue should not get duplicated. +In the event that the satellite does not complete the metainfo loop (e.g. satellite is shutdown), the service will re-enter the metainfo loop for all exiting nodes where `nodes.exit_loop_completed_at` is null. Pieces that already exist in the queue should not get duplicated. ## Rationale diff --git a/satellite/satellitedb/dbx/satellitedb.dbx b/satellite/satellitedb/dbx/satellitedb.dbx index 9ccd5527f..b6af48026 100644 --- a/satellite/satellitedb/dbx/satellitedb.dbx +++ b/satellite/satellitedb/dbx/satellitedb.dbx @@ -167,6 +167,10 @@ model node ( field audit_reputation_beta float64 ( updatable ) field uptime_reputation_alpha float64 ( updatable ) field uptime_reputation_beta float64 ( updatable ) + + field exit_initiated_at timestamp ( updatable, nullable ) + field exit_loop_completed_at timestamp ( updatable, nullable ) + field exit_finished_at timestamp ( updatable, nullable ) ) create node ( noreturn ) @@ -850,3 +854,63 @@ read limitoffset ( // After where bucket_metainfo.name > ? orderby asc bucket_metainfo.name ) + +//--- graceful exit progress ---// + +model graceful_exit_progress ( + table graceful_exit_progress + key node_id + + field node_id blob + field bytes_transferred int64 ( updatable ) + field updated_at timestamp ( autoinsert, autoupdate ) +) + +create graceful_exit_progress ( noreturn ) +update graceful_exit_progress ( + where graceful_exit_progress.node_id = ? + noreturn +) +delete graceful_exit_progress ( where graceful_exit_progress.node_id = ? ) +read one ( + select graceful_exit_progress + where graceful_exit_progress.node_id = ? +) + +//--- graceful exit transfer queue ---// + +model graceful_exit_transfer_queue ( + table graceful_exit_transfer_queue + key node_id path + + field node_id blob + field path blob + field piece_num int + field durability_ratio float64 ( updatable ) + field queued_at timestamp ( autoinsert ) + field requested_at timestamp ( updatable, nullable ) + field last_failed_at timestamp ( updatable, nullable ) + field last_failed_code int ( updatable, nullable ) + field failed_count int ( updatable, nullable ) + field finished_at timestamp ( updatable, nullable ) +) + +create graceful_exit_transfer_queue ( noreturn ) +update graceful_exit_transfer_queue ( + where graceful_exit_transfer_queue.node_id = ? + where graceful_exit_transfer_queue.path = ? + noreturn +) +delete graceful_exit_transfer_queue ( + where graceful_exit_transfer_queue.node_id = ? +) + +delete graceful_exit_transfer_queue ( + where graceful_exit_transfer_queue.node_id = ? + where graceful_exit_transfer_queue.path = ? +) +read one ( + select graceful_exit_transfer_queue + where graceful_exit_transfer_queue.node_id = ? + where graceful_exit_transfer_queue.path = ? +) diff --git a/satellite/satellitedb/dbx/satellitedb.dbx.go b/satellite/satellitedb/dbx/satellitedb.dbx.go index acfba8a96..50b272912 100644 --- a/satellite/satellitedb/dbx/satellitedb.dbx.go +++ b/satellite/satellitedb/dbx/satellitedb.dbx.go @@ -327,6 +327,25 @@ CREATE TABLE bucket_usages ( audit_egress bigint NOT NULL, PRIMARY KEY ( id ) ); +CREATE TABLE graceful_exit_progress ( + node_id bytea NOT NULL, + bytes_transferred bigint NOT NULL, + updated_at timestamp with time zone NOT NULL, + PRIMARY KEY ( node_id ) +); +CREATE TABLE graceful_exit_transfer_queue ( + node_id bytea NOT NULL, + path bytea NOT NULL, + piece_num integer NOT NULL, + durability_ratio double precision NOT NULL, + queued_at timestamp with time zone NOT NULL, + requested_at timestamp with time zone, + last_failed_at timestamp with time zone, + last_failed_code integer, + failed_count integer, + finished_at timestamp with time zone, + PRIMARY KEY ( node_id, path ) +); CREATE TABLE injuredsegments ( path bytea NOT NULL, data bytea NOT NULL, @@ -373,6 +392,9 @@ CREATE TABLE nodes ( audit_reputation_beta double precision NOT NULL, uptime_reputation_alpha double precision NOT NULL, uptime_reputation_beta double precision NOT NULL, + exit_initiated_at timestamp with time zone, + exit_loop_completed_at timestamp with time zone, + exit_finished_at timestamp with time zone, PRIMARY KEY ( id ) ); CREATE TABLE offers ( @@ -678,6 +700,25 @@ CREATE TABLE bucket_usages ( audit_egress INTEGER NOT NULL, PRIMARY KEY ( id ) ); +CREATE TABLE graceful_exit_progress ( + node_id BLOB NOT NULL, + bytes_transferred INTEGER NOT NULL, + updated_at TIMESTAMP NOT NULL, + PRIMARY KEY ( node_id ) +); +CREATE TABLE graceful_exit_transfer_queue ( + node_id BLOB NOT NULL, + path BLOB NOT NULL, + piece_num INTEGER NOT NULL, + durability_ratio REAL NOT NULL, + queued_at TIMESTAMP NOT NULL, + requested_at TIMESTAMP, + last_failed_at TIMESTAMP, + last_failed_code INTEGER, + failed_count INTEGER, + finished_at TIMESTAMP, + PRIMARY KEY ( node_id, path ) +); CREATE TABLE injuredsegments ( path BLOB NOT NULL, data BLOB NOT NULL, @@ -724,6 +765,9 @@ CREATE TABLE nodes ( audit_reputation_beta REAL NOT NULL, uptime_reputation_alpha REAL NOT NULL, uptime_reputation_beta REAL NOT NULL, + exit_initiated_at TIMESTAMP, + exit_loop_completed_at TIMESTAMP, + exit_finished_at TIMESTAMP, PRIMARY KEY ( id ) ); CREATE TABLE offers ( @@ -1819,6 +1863,372 @@ func (f BucketUsage_AuditEgress_Field) value() interface{} { func (BucketUsage_AuditEgress_Field) _Column() string { return "audit_egress" } +type GracefulExitProgress struct { + NodeId []byte + BytesTransferred int64 + UpdatedAt time.Time +} + +func (GracefulExitProgress) _Table() string { return "graceful_exit_progress" } + +type GracefulExitProgress_Update_Fields struct { + BytesTransferred GracefulExitProgress_BytesTransferred_Field +} + +type GracefulExitProgress_NodeId_Field struct { + _set bool + _null bool + _value []byte +} + +func GracefulExitProgress_NodeId(v []byte) GracefulExitProgress_NodeId_Field { + return GracefulExitProgress_NodeId_Field{_set: true, _value: v} +} + +func (f GracefulExitProgress_NodeId_Field) value() interface{} { + if !f._set || f._null { + return nil + } + return f._value +} + +func (GracefulExitProgress_NodeId_Field) _Column() string { return "node_id" } + +type GracefulExitProgress_BytesTransferred_Field struct { + _set bool + _null bool + _value int64 +} + +func GracefulExitProgress_BytesTransferred(v int64) GracefulExitProgress_BytesTransferred_Field { + return GracefulExitProgress_BytesTransferred_Field{_set: true, _value: v} +} + +func (f GracefulExitProgress_BytesTransferred_Field) value() interface{} { + if !f._set || f._null { + return nil + } + return f._value +} + +func (GracefulExitProgress_BytesTransferred_Field) _Column() string { return "bytes_transferred" } + +type GracefulExitProgress_UpdatedAt_Field struct { + _set bool + _null bool + _value time.Time +} + +func GracefulExitProgress_UpdatedAt(v time.Time) GracefulExitProgress_UpdatedAt_Field { + return GracefulExitProgress_UpdatedAt_Field{_set: true, _value: v} +} + +func (f GracefulExitProgress_UpdatedAt_Field) value() interface{} { + if !f._set || f._null { + return nil + } + return f._value +} + +func (GracefulExitProgress_UpdatedAt_Field) _Column() string { return "updated_at" } + +type GracefulExitTransferQueue struct { + NodeId []byte + Path []byte + PieceNum int + DurabilityRatio float64 + QueuedAt time.Time + RequestedAt *time.Time + LastFailedAt *time.Time + LastFailedCode *int + FailedCount *int + FinishedAt *time.Time +} + +func (GracefulExitTransferQueue) _Table() string { return "graceful_exit_transfer_queue" } + +type GracefulExitTransferQueue_Create_Fields struct { + RequestedAt GracefulExitTransferQueue_RequestedAt_Field + LastFailedAt GracefulExitTransferQueue_LastFailedAt_Field + LastFailedCode GracefulExitTransferQueue_LastFailedCode_Field + FailedCount GracefulExitTransferQueue_FailedCount_Field + FinishedAt GracefulExitTransferQueue_FinishedAt_Field +} + +type GracefulExitTransferQueue_Update_Fields struct { + DurabilityRatio GracefulExitTransferQueue_DurabilityRatio_Field + RequestedAt GracefulExitTransferQueue_RequestedAt_Field + LastFailedAt GracefulExitTransferQueue_LastFailedAt_Field + LastFailedCode GracefulExitTransferQueue_LastFailedCode_Field + FailedCount GracefulExitTransferQueue_FailedCount_Field + FinishedAt GracefulExitTransferQueue_FinishedAt_Field +} + +type GracefulExitTransferQueue_NodeId_Field struct { + _set bool + _null bool + _value []byte +} + +func GracefulExitTransferQueue_NodeId(v []byte) GracefulExitTransferQueue_NodeId_Field { + return GracefulExitTransferQueue_NodeId_Field{_set: true, _value: v} +} + +func (f GracefulExitTransferQueue_NodeId_Field) value() interface{} { + if !f._set || f._null { + return nil + } + return f._value +} + +func (GracefulExitTransferQueue_NodeId_Field) _Column() string { return "node_id" } + +type GracefulExitTransferQueue_Path_Field struct { + _set bool + _null bool + _value []byte +} + +func GracefulExitTransferQueue_Path(v []byte) GracefulExitTransferQueue_Path_Field { + return GracefulExitTransferQueue_Path_Field{_set: true, _value: v} +} + +func (f GracefulExitTransferQueue_Path_Field) value() interface{} { + if !f._set || f._null { + return nil + } + return f._value +} + +func (GracefulExitTransferQueue_Path_Field) _Column() string { return "path" } + +type GracefulExitTransferQueue_PieceNum_Field struct { + _set bool + _null bool + _value int +} + +func GracefulExitTransferQueue_PieceNum(v int) GracefulExitTransferQueue_PieceNum_Field { + return GracefulExitTransferQueue_PieceNum_Field{_set: true, _value: v} +} + +func (f GracefulExitTransferQueue_PieceNum_Field) value() interface{} { + if !f._set || f._null { + return nil + } + return f._value +} + +func (GracefulExitTransferQueue_PieceNum_Field) _Column() string { return "piece_num" } + +type GracefulExitTransferQueue_DurabilityRatio_Field struct { + _set bool + _null bool + _value float64 +} + +func GracefulExitTransferQueue_DurabilityRatio(v float64) GracefulExitTransferQueue_DurabilityRatio_Field { + return GracefulExitTransferQueue_DurabilityRatio_Field{_set: true, _value: v} +} + +func (f GracefulExitTransferQueue_DurabilityRatio_Field) value() interface{} { + if !f._set || f._null { + return nil + } + return f._value +} + +func (GracefulExitTransferQueue_DurabilityRatio_Field) _Column() string { return "durability_ratio" } + +type GracefulExitTransferQueue_QueuedAt_Field struct { + _set bool + _null bool + _value time.Time +} + +func GracefulExitTransferQueue_QueuedAt(v time.Time) GracefulExitTransferQueue_QueuedAt_Field { + return GracefulExitTransferQueue_QueuedAt_Field{_set: true, _value: v} +} + +func (f GracefulExitTransferQueue_QueuedAt_Field) value() interface{} { + if !f._set || f._null { + return nil + } + return f._value +} + +func (GracefulExitTransferQueue_QueuedAt_Field) _Column() string { return "queued_at" } + +type GracefulExitTransferQueue_RequestedAt_Field struct { + _set bool + _null bool + _value *time.Time +} + +func GracefulExitTransferQueue_RequestedAt(v time.Time) GracefulExitTransferQueue_RequestedAt_Field { + return GracefulExitTransferQueue_RequestedAt_Field{_set: true, _value: &v} +} + +func GracefulExitTransferQueue_RequestedAt_Raw(v *time.Time) GracefulExitTransferQueue_RequestedAt_Field { + if v == nil { + return GracefulExitTransferQueue_RequestedAt_Null() + } + return GracefulExitTransferQueue_RequestedAt(*v) +} + +func GracefulExitTransferQueue_RequestedAt_Null() GracefulExitTransferQueue_RequestedAt_Field { + return GracefulExitTransferQueue_RequestedAt_Field{_set: true, _null: true} +} + +func (f GracefulExitTransferQueue_RequestedAt_Field) isnull() bool { + return !f._set || f._null || f._value == nil +} + +func (f GracefulExitTransferQueue_RequestedAt_Field) value() interface{} { + if !f._set || f._null { + return nil + } + return f._value +} + +func (GracefulExitTransferQueue_RequestedAt_Field) _Column() string { return "requested_at" } + +type GracefulExitTransferQueue_LastFailedAt_Field struct { + _set bool + _null bool + _value *time.Time +} + +func GracefulExitTransferQueue_LastFailedAt(v time.Time) GracefulExitTransferQueue_LastFailedAt_Field { + return GracefulExitTransferQueue_LastFailedAt_Field{_set: true, _value: &v} +} + +func GracefulExitTransferQueue_LastFailedAt_Raw(v *time.Time) GracefulExitTransferQueue_LastFailedAt_Field { + if v == nil { + return GracefulExitTransferQueue_LastFailedAt_Null() + } + return GracefulExitTransferQueue_LastFailedAt(*v) +} + +func GracefulExitTransferQueue_LastFailedAt_Null() GracefulExitTransferQueue_LastFailedAt_Field { + return GracefulExitTransferQueue_LastFailedAt_Field{_set: true, _null: true} +} + +func (f GracefulExitTransferQueue_LastFailedAt_Field) isnull() bool { + return !f._set || f._null || f._value == nil +} + +func (f GracefulExitTransferQueue_LastFailedAt_Field) value() interface{} { + if !f._set || f._null { + return nil + } + return f._value +} + +func (GracefulExitTransferQueue_LastFailedAt_Field) _Column() string { return "last_failed_at" } + +type GracefulExitTransferQueue_LastFailedCode_Field struct { + _set bool + _null bool + _value *int +} + +func GracefulExitTransferQueue_LastFailedCode(v int) GracefulExitTransferQueue_LastFailedCode_Field { + return GracefulExitTransferQueue_LastFailedCode_Field{_set: true, _value: &v} +} + +func GracefulExitTransferQueue_LastFailedCode_Raw(v *int) GracefulExitTransferQueue_LastFailedCode_Field { + if v == nil { + return GracefulExitTransferQueue_LastFailedCode_Null() + } + return GracefulExitTransferQueue_LastFailedCode(*v) +} + +func GracefulExitTransferQueue_LastFailedCode_Null() GracefulExitTransferQueue_LastFailedCode_Field { + return GracefulExitTransferQueue_LastFailedCode_Field{_set: true, _null: true} +} + +func (f GracefulExitTransferQueue_LastFailedCode_Field) isnull() bool { + return !f._set || f._null || f._value == nil +} + +func (f GracefulExitTransferQueue_LastFailedCode_Field) value() interface{} { + if !f._set || f._null { + return nil + } + return f._value +} + +func (GracefulExitTransferQueue_LastFailedCode_Field) _Column() string { return "last_failed_code" } + +type GracefulExitTransferQueue_FailedCount_Field struct { + _set bool + _null bool + _value *int +} + +func GracefulExitTransferQueue_FailedCount(v int) GracefulExitTransferQueue_FailedCount_Field { + return GracefulExitTransferQueue_FailedCount_Field{_set: true, _value: &v} +} + +func GracefulExitTransferQueue_FailedCount_Raw(v *int) GracefulExitTransferQueue_FailedCount_Field { + if v == nil { + return GracefulExitTransferQueue_FailedCount_Null() + } + return GracefulExitTransferQueue_FailedCount(*v) +} + +func GracefulExitTransferQueue_FailedCount_Null() GracefulExitTransferQueue_FailedCount_Field { + return GracefulExitTransferQueue_FailedCount_Field{_set: true, _null: true} +} + +func (f GracefulExitTransferQueue_FailedCount_Field) isnull() bool { + return !f._set || f._null || f._value == nil +} + +func (f GracefulExitTransferQueue_FailedCount_Field) value() interface{} { + if !f._set || f._null { + return nil + } + return f._value +} + +func (GracefulExitTransferQueue_FailedCount_Field) _Column() string { return "failed_count" } + +type GracefulExitTransferQueue_FinishedAt_Field struct { + _set bool + _null bool + _value *time.Time +} + +func GracefulExitTransferQueue_FinishedAt(v time.Time) GracefulExitTransferQueue_FinishedAt_Field { + return GracefulExitTransferQueue_FinishedAt_Field{_set: true, _value: &v} +} + +func GracefulExitTransferQueue_FinishedAt_Raw(v *time.Time) GracefulExitTransferQueue_FinishedAt_Field { + if v == nil { + return GracefulExitTransferQueue_FinishedAt_Null() + } + return GracefulExitTransferQueue_FinishedAt(*v) +} + +func GracefulExitTransferQueue_FinishedAt_Null() GracefulExitTransferQueue_FinishedAt_Field { + return GracefulExitTransferQueue_FinishedAt_Field{_set: true, _null: true} +} + +func (f GracefulExitTransferQueue_FinishedAt_Field) isnull() bool { + return !f._set || f._null || f._value == nil +} + +func (f GracefulExitTransferQueue_FinishedAt_Field) value() interface{} { + if !f._set || f._null { + return nil + } + return f._value +} + +func (GracefulExitTransferQueue_FinishedAt_Field) _Column() string { return "finished_at" } + type Injuredsegment struct { Path []byte Data []byte @@ -2050,12 +2460,18 @@ type Node struct { AuditReputationBeta float64 UptimeReputationAlpha float64 UptimeReputationBeta float64 + ExitInitiatedAt *time.Time + ExitLoopCompletedAt *time.Time + ExitFinishedAt *time.Time } func (Node) _Table() string { return "nodes" } type Node_Create_Fields struct { - Disqualified Node_Disqualified_Field + Disqualified Node_Disqualified_Field + ExitInitiatedAt Node_ExitInitiatedAt_Field + ExitLoopCompletedAt Node_ExitLoopCompletedAt_Field + ExitFinishedAt Node_ExitFinishedAt_Field } type Node_Update_Fields struct { @@ -2087,6 +2503,9 @@ type Node_Update_Fields struct { AuditReputationBeta Node_AuditReputationBeta_Field UptimeReputationAlpha Node_UptimeReputationAlpha_Field UptimeReputationBeta Node_UptimeReputationBeta_Field + ExitInitiatedAt Node_ExitInitiatedAt_Field + ExitLoopCompletedAt Node_ExitLoopCompletedAt_Field + ExitFinishedAt Node_ExitFinishedAt_Field } type Node_Id_Field struct { @@ -2691,6 +3110,102 @@ func (f Node_UptimeReputationBeta_Field) value() interface{} { func (Node_UptimeReputationBeta_Field) _Column() string { return "uptime_reputation_beta" } +type Node_ExitInitiatedAt_Field struct { + _set bool + _null bool + _value *time.Time +} + +func Node_ExitInitiatedAt(v time.Time) Node_ExitInitiatedAt_Field { + return Node_ExitInitiatedAt_Field{_set: true, _value: &v} +} + +func Node_ExitInitiatedAt_Raw(v *time.Time) Node_ExitInitiatedAt_Field { + if v == nil { + return Node_ExitInitiatedAt_Null() + } + return Node_ExitInitiatedAt(*v) +} + +func Node_ExitInitiatedAt_Null() Node_ExitInitiatedAt_Field { + return Node_ExitInitiatedAt_Field{_set: true, _null: true} +} + +func (f Node_ExitInitiatedAt_Field) isnull() bool { return !f._set || f._null || f._value == nil } + +func (f Node_ExitInitiatedAt_Field) value() interface{} { + if !f._set || f._null { + return nil + } + return f._value +} + +func (Node_ExitInitiatedAt_Field) _Column() string { return "exit_initiated_at" } + +type Node_ExitLoopCompletedAt_Field struct { + _set bool + _null bool + _value *time.Time +} + +func Node_ExitLoopCompletedAt(v time.Time) Node_ExitLoopCompletedAt_Field { + return Node_ExitLoopCompletedAt_Field{_set: true, _value: &v} +} + +func Node_ExitLoopCompletedAt_Raw(v *time.Time) Node_ExitLoopCompletedAt_Field { + if v == nil { + return Node_ExitLoopCompletedAt_Null() + } + return Node_ExitLoopCompletedAt(*v) +} + +func Node_ExitLoopCompletedAt_Null() Node_ExitLoopCompletedAt_Field { + return Node_ExitLoopCompletedAt_Field{_set: true, _null: true} +} + +func (f Node_ExitLoopCompletedAt_Field) isnull() bool { return !f._set || f._null || f._value == nil } + +func (f Node_ExitLoopCompletedAt_Field) value() interface{} { + if !f._set || f._null { + return nil + } + return f._value +} + +func (Node_ExitLoopCompletedAt_Field) _Column() string { return "exit_loop_completed_at" } + +type Node_ExitFinishedAt_Field struct { + _set bool + _null bool + _value *time.Time +} + +func Node_ExitFinishedAt(v time.Time) Node_ExitFinishedAt_Field { + return Node_ExitFinishedAt_Field{_set: true, _value: &v} +} + +func Node_ExitFinishedAt_Raw(v *time.Time) Node_ExitFinishedAt_Field { + if v == nil { + return Node_ExitFinishedAt_Null() + } + return Node_ExitFinishedAt(*v) +} + +func Node_ExitFinishedAt_Null() Node_ExitFinishedAt_Field { + return Node_ExitFinishedAt_Field{_set: true, _null: true} +} + +func (f Node_ExitFinishedAt_Field) isnull() bool { return !f._set || f._null || f._value == nil } + +func (f Node_ExitFinishedAt_Field) value() interface{} { + if !f._set || f._null { + return nil + } + return f._value +} + +func (Node_ExitFinishedAt_Field) _Column() string { return "exit_finished_at" } + type Offer struct { Id int Name string @@ -5782,13 +6297,16 @@ func (obj *postgresImpl) CreateNoReturn_Node(ctx context.Context, __audit_reputation_beta_val := node_audit_reputation_beta.value() __uptime_reputation_alpha_val := node_uptime_reputation_alpha.value() __uptime_reputation_beta_val := node_uptime_reputation_beta.value() + __exit_initiated_at_val := optional.ExitInitiatedAt.value() + __exit_loop_completed_at_val := optional.ExitLoopCompletedAt.value() + __exit_finished_at_val := optional.ExitFinishedAt.value() - var __embed_stmt = __sqlbundle_Literal("INSERT INTO nodes ( id, address, last_net, protocol, type, email, wallet, free_bandwidth, free_disk, piece_count, major, minor, patch, hash, timestamp, release, latency_90, audit_success_count, total_audit_count, uptime_success_count, total_uptime_count, created_at, updated_at, last_contact_success, last_contact_failure, contained, disqualified, audit_reputation_alpha, audit_reputation_beta, uptime_reputation_alpha, uptime_reputation_beta ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )") + var __embed_stmt = __sqlbundle_Literal("INSERT INTO nodes ( id, address, last_net, protocol, type, email, wallet, free_bandwidth, free_disk, piece_count, major, minor, patch, hash, timestamp, release, latency_90, audit_success_count, total_audit_count, uptime_success_count, total_uptime_count, created_at, updated_at, last_contact_success, last_contact_failure, contained, disqualified, audit_reputation_alpha, audit_reputation_beta, uptime_reputation_alpha, uptime_reputation_beta, exit_initiated_at, exit_loop_completed_at, exit_finished_at ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )") var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) - obj.logStmt(__stmt, __id_val, __address_val, __last_net_val, __protocol_val, __type_val, __email_val, __wallet_val, __free_bandwidth_val, __free_disk_val, __piece_count_val, __major_val, __minor_val, __patch_val, __hash_val, __timestamp_val, __release_val, __latency_90_val, __audit_success_count_val, __total_audit_count_val, __uptime_success_count_val, __total_uptime_count_val, __created_at_val, __updated_at_val, __last_contact_success_val, __last_contact_failure_val, __contained_val, __disqualified_val, __audit_reputation_alpha_val, __audit_reputation_beta_val, __uptime_reputation_alpha_val, __uptime_reputation_beta_val) + obj.logStmt(__stmt, __id_val, __address_val, __last_net_val, __protocol_val, __type_val, __email_val, __wallet_val, __free_bandwidth_val, __free_disk_val, __piece_count_val, __major_val, __minor_val, __patch_val, __hash_val, __timestamp_val, __release_val, __latency_90_val, __audit_success_count_val, __total_audit_count_val, __uptime_success_count_val, __total_uptime_count_val, __created_at_val, __updated_at_val, __last_contact_success_val, __last_contact_failure_val, __contained_val, __disqualified_val, __audit_reputation_alpha_val, __audit_reputation_beta_val, __uptime_reputation_alpha_val, __uptime_reputation_beta_val, __exit_initiated_at_val, __exit_loop_completed_at_val, __exit_finished_at_val) - _, err = obj.driver.Exec(__stmt, __id_val, __address_val, __last_net_val, __protocol_val, __type_val, __email_val, __wallet_val, __free_bandwidth_val, __free_disk_val, __piece_count_val, __major_val, __minor_val, __patch_val, __hash_val, __timestamp_val, __release_val, __latency_90_val, __audit_success_count_val, __total_audit_count_val, __uptime_success_count_val, __total_uptime_count_val, __created_at_val, __updated_at_val, __last_contact_success_val, __last_contact_failure_val, __contained_val, __disqualified_val, __audit_reputation_alpha_val, __audit_reputation_beta_val, __uptime_reputation_alpha_val, __uptime_reputation_beta_val) + _, err = obj.driver.Exec(__stmt, __id_val, __address_val, __last_net_val, __protocol_val, __type_val, __email_val, __wallet_val, __free_bandwidth_val, __free_disk_val, __piece_count_val, __major_val, __minor_val, __patch_val, __hash_val, __timestamp_val, __release_val, __latency_90_val, __audit_success_count_val, __total_audit_count_val, __uptime_success_count_val, __total_uptime_count_val, __created_at_val, __updated_at_val, __last_contact_success_val, __last_contact_failure_val, __contained_val, __disqualified_val, __audit_reputation_alpha_val, __audit_reputation_beta_val, __uptime_reputation_alpha_val, __uptime_reputation_beta_val, __exit_initiated_at_val, __exit_loop_completed_at_val, __exit_finished_at_val) if err != nil { return obj.makeErr(err) } @@ -6332,6 +6850,62 @@ func (obj *postgresImpl) Create_BucketMetainfo(ctx context.Context, } +func (obj *postgresImpl) CreateNoReturn_GracefulExitProgress(ctx context.Context, + graceful_exit_progress_node_id GracefulExitProgress_NodeId_Field, + graceful_exit_progress_bytes_transferred GracefulExitProgress_BytesTransferred_Field) ( + err error) { + + __now := obj.db.Hooks.Now().UTC() + __node_id_val := graceful_exit_progress_node_id.value() + __bytes_transferred_val := graceful_exit_progress_bytes_transferred.value() + __updated_at_val := __now + + var __embed_stmt = __sqlbundle_Literal("INSERT INTO graceful_exit_progress ( node_id, bytes_transferred, updated_at ) VALUES ( ?, ?, ? )") + + var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) + obj.logStmt(__stmt, __node_id_val, __bytes_transferred_val, __updated_at_val) + + _, err = obj.driver.Exec(__stmt, __node_id_val, __bytes_transferred_val, __updated_at_val) + if err != nil { + return obj.makeErr(err) + } + return nil + +} + +func (obj *postgresImpl) CreateNoReturn_GracefulExitTransferQueue(ctx context.Context, + graceful_exit_transfer_queue_node_id GracefulExitTransferQueue_NodeId_Field, + graceful_exit_transfer_queue_path GracefulExitTransferQueue_Path_Field, + graceful_exit_transfer_queue_piece_num GracefulExitTransferQueue_PieceNum_Field, + graceful_exit_transfer_queue_durability_ratio GracefulExitTransferQueue_DurabilityRatio_Field, + optional GracefulExitTransferQueue_Create_Fields) ( + err error) { + + __now := obj.db.Hooks.Now().UTC() + __node_id_val := graceful_exit_transfer_queue_node_id.value() + __path_val := graceful_exit_transfer_queue_path.value() + __piece_num_val := graceful_exit_transfer_queue_piece_num.value() + __durability_ratio_val := graceful_exit_transfer_queue_durability_ratio.value() + __queued_at_val := __now + __requested_at_val := optional.RequestedAt.value() + __last_failed_at_val := optional.LastFailedAt.value() + __last_failed_code_val := optional.LastFailedCode.value() + __failed_count_val := optional.FailedCount.value() + __finished_at_val := optional.FinishedAt.value() + + var __embed_stmt = __sqlbundle_Literal("INSERT INTO graceful_exit_transfer_queue ( node_id, path, piece_num, durability_ratio, queued_at, requested_at, last_failed_at, last_failed_code, failed_count, finished_at ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )") + + var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) + obj.logStmt(__stmt, __node_id_val, __path_val, __piece_num_val, __durability_ratio_val, __queued_at_val, __requested_at_val, __last_failed_at_val, __last_failed_code_val, __failed_count_val, __finished_at_val) + + _, err = obj.driver.Exec(__stmt, __node_id_val, __path_val, __piece_num_val, __durability_ratio_val, __queued_at_val, __requested_at_val, __last_failed_at_val, __last_failed_code_val, __failed_count_val, __finished_at_val) + if err != nil { + return obj.makeErr(err) + } + return nil + +} + func (obj *postgresImpl) Get_ValueAttribution_By_ProjectId_And_BucketName(ctx context.Context, value_attribution_project_id ValueAttribution_ProjectId_Field, value_attribution_bucket_name ValueAttribution_BucketName_Field) ( @@ -6514,7 +7088,7 @@ func (obj *postgresImpl) Get_Node_By_Id(ctx context.Context, node_id Node_Id_Field) ( node *Node, err error) { - var __embed_stmt = __sqlbundle_Literal("SELECT nodes.id, nodes.address, nodes.last_net, nodes.protocol, nodes.type, nodes.email, nodes.wallet, nodes.free_bandwidth, nodes.free_disk, nodes.piece_count, nodes.major, nodes.minor, nodes.patch, nodes.hash, nodes.timestamp, nodes.release, nodes.latency_90, nodes.audit_success_count, nodes.total_audit_count, nodes.uptime_success_count, nodes.total_uptime_count, nodes.created_at, nodes.updated_at, nodes.last_contact_success, nodes.last_contact_failure, nodes.contained, nodes.disqualified, nodes.audit_reputation_alpha, nodes.audit_reputation_beta, nodes.uptime_reputation_alpha, nodes.uptime_reputation_beta FROM nodes WHERE nodes.id = ?") + var __embed_stmt = __sqlbundle_Literal("SELECT nodes.id, nodes.address, nodes.last_net, nodes.protocol, nodes.type, nodes.email, nodes.wallet, nodes.free_bandwidth, nodes.free_disk, nodes.piece_count, nodes.major, nodes.minor, nodes.patch, nodes.hash, nodes.timestamp, nodes.release, nodes.latency_90, nodes.audit_success_count, nodes.total_audit_count, nodes.uptime_success_count, nodes.total_uptime_count, nodes.created_at, nodes.updated_at, nodes.last_contact_success, nodes.last_contact_failure, nodes.contained, nodes.disqualified, nodes.audit_reputation_alpha, nodes.audit_reputation_beta, nodes.uptime_reputation_alpha, nodes.uptime_reputation_beta, nodes.exit_initiated_at, nodes.exit_loop_completed_at, nodes.exit_finished_at FROM nodes WHERE nodes.id = ?") var __values []interface{} __values = append(__values, node_id.value()) @@ -6523,7 +7097,7 @@ func (obj *postgresImpl) Get_Node_By_Id(ctx context.Context, obj.logStmt(__stmt, __values...) node = &Node{} - err = obj.driver.QueryRow(__stmt, __values...).Scan(&node.Id, &node.Address, &node.LastNet, &node.Protocol, &node.Type, &node.Email, &node.Wallet, &node.FreeBandwidth, &node.FreeDisk, &node.PieceCount, &node.Major, &node.Minor, &node.Patch, &node.Hash, &node.Timestamp, &node.Release, &node.Latency90, &node.AuditSuccessCount, &node.TotalAuditCount, &node.UptimeSuccessCount, &node.TotalUptimeCount, &node.CreatedAt, &node.UpdatedAt, &node.LastContactSuccess, &node.LastContactFailure, &node.Contained, &node.Disqualified, &node.AuditReputationAlpha, &node.AuditReputationBeta, &node.UptimeReputationAlpha, &node.UptimeReputationBeta) + err = obj.driver.QueryRow(__stmt, __values...).Scan(&node.Id, &node.Address, &node.LastNet, &node.Protocol, &node.Type, &node.Email, &node.Wallet, &node.FreeBandwidth, &node.FreeDisk, &node.PieceCount, &node.Major, &node.Minor, &node.Patch, &node.Hash, &node.Timestamp, &node.Release, &node.Latency90, &node.AuditSuccessCount, &node.TotalAuditCount, &node.UptimeSuccessCount, &node.TotalUptimeCount, &node.CreatedAt, &node.UpdatedAt, &node.LastContactSuccess, &node.LastContactFailure, &node.Contained, &node.Disqualified, &node.AuditReputationAlpha, &node.AuditReputationBeta, &node.UptimeReputationAlpha, &node.UptimeReputationBeta, &node.ExitInitiatedAt, &node.ExitLoopCompletedAt, &node.ExitFinishedAt) if err != nil { return nil, obj.makeErr(err) } @@ -6568,7 +7142,7 @@ func (obj *postgresImpl) Limited_Node_By_Id_GreaterOrEqual_OrderBy_Asc_Id(ctx co limit int, offset int64) ( rows []*Node, err error) { - var __embed_stmt = __sqlbundle_Literal("SELECT nodes.id, nodes.address, nodes.last_net, nodes.protocol, nodes.type, nodes.email, nodes.wallet, nodes.free_bandwidth, nodes.free_disk, nodes.piece_count, nodes.major, nodes.minor, nodes.patch, nodes.hash, nodes.timestamp, nodes.release, nodes.latency_90, nodes.audit_success_count, nodes.total_audit_count, nodes.uptime_success_count, nodes.total_uptime_count, nodes.created_at, nodes.updated_at, nodes.last_contact_success, nodes.last_contact_failure, nodes.contained, nodes.disqualified, nodes.audit_reputation_alpha, nodes.audit_reputation_beta, nodes.uptime_reputation_alpha, nodes.uptime_reputation_beta FROM nodes WHERE nodes.id >= ? ORDER BY nodes.id LIMIT ? OFFSET ?") + var __embed_stmt = __sqlbundle_Literal("SELECT nodes.id, nodes.address, nodes.last_net, nodes.protocol, nodes.type, nodes.email, nodes.wallet, nodes.free_bandwidth, nodes.free_disk, nodes.piece_count, nodes.major, nodes.minor, nodes.patch, nodes.hash, nodes.timestamp, nodes.release, nodes.latency_90, nodes.audit_success_count, nodes.total_audit_count, nodes.uptime_success_count, nodes.total_uptime_count, nodes.created_at, nodes.updated_at, nodes.last_contact_success, nodes.last_contact_failure, nodes.contained, nodes.disqualified, nodes.audit_reputation_alpha, nodes.audit_reputation_beta, nodes.uptime_reputation_alpha, nodes.uptime_reputation_beta, nodes.exit_initiated_at, nodes.exit_loop_completed_at, nodes.exit_finished_at FROM nodes WHERE nodes.id >= ? ORDER BY nodes.id LIMIT ? OFFSET ?") var __values []interface{} __values = append(__values, node_id_greater_or_equal.value()) @@ -6586,7 +7160,7 @@ func (obj *postgresImpl) Limited_Node_By_Id_GreaterOrEqual_OrderBy_Asc_Id(ctx co for __rows.Next() { node := &Node{} - err = __rows.Scan(&node.Id, &node.Address, &node.LastNet, &node.Protocol, &node.Type, &node.Email, &node.Wallet, &node.FreeBandwidth, &node.FreeDisk, &node.PieceCount, &node.Major, &node.Minor, &node.Patch, &node.Hash, &node.Timestamp, &node.Release, &node.Latency90, &node.AuditSuccessCount, &node.TotalAuditCount, &node.UptimeSuccessCount, &node.TotalUptimeCount, &node.CreatedAt, &node.UpdatedAt, &node.LastContactSuccess, &node.LastContactFailure, &node.Contained, &node.Disqualified, &node.AuditReputationAlpha, &node.AuditReputationBeta, &node.UptimeReputationAlpha, &node.UptimeReputationBeta) + err = __rows.Scan(&node.Id, &node.Address, &node.LastNet, &node.Protocol, &node.Type, &node.Email, &node.Wallet, &node.FreeBandwidth, &node.FreeDisk, &node.PieceCount, &node.Major, &node.Minor, &node.Patch, &node.Hash, &node.Timestamp, &node.Release, &node.Latency90, &node.AuditSuccessCount, &node.TotalAuditCount, &node.UptimeSuccessCount, &node.TotalUptimeCount, &node.CreatedAt, &node.UpdatedAt, &node.LastContactSuccess, &node.LastContactFailure, &node.Contained, &node.Disqualified, &node.AuditReputationAlpha, &node.AuditReputationBeta, &node.UptimeReputationAlpha, &node.UptimeReputationBeta, &node.ExitInitiatedAt, &node.ExitLoopCompletedAt, &node.ExitFinishedAt) if err != nil { return nil, obj.makeErr(err) } @@ -7981,6 +8555,49 @@ func (obj *postgresImpl) Limited_BucketMetainfo_By_ProjectId_And_Name_Greater_Or } +func (obj *postgresImpl) Get_GracefulExitProgress_By_NodeId(ctx context.Context, + graceful_exit_progress_node_id GracefulExitProgress_NodeId_Field) ( + graceful_exit_progress *GracefulExitProgress, err error) { + + var __embed_stmt = __sqlbundle_Literal("SELECT graceful_exit_progress.node_id, graceful_exit_progress.bytes_transferred, graceful_exit_progress.updated_at FROM graceful_exit_progress WHERE graceful_exit_progress.node_id = ?") + + var __values []interface{} + __values = append(__values, graceful_exit_progress_node_id.value()) + + var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) + obj.logStmt(__stmt, __values...) + + graceful_exit_progress = &GracefulExitProgress{} + err = obj.driver.QueryRow(__stmt, __values...).Scan(&graceful_exit_progress.NodeId, &graceful_exit_progress.BytesTransferred, &graceful_exit_progress.UpdatedAt) + if err != nil { + return nil, obj.makeErr(err) + } + return graceful_exit_progress, nil + +} + +func (obj *postgresImpl) Get_GracefulExitTransferQueue_By_NodeId_And_Path(ctx context.Context, + graceful_exit_transfer_queue_node_id GracefulExitTransferQueue_NodeId_Field, + graceful_exit_transfer_queue_path GracefulExitTransferQueue_Path_Field) ( + graceful_exit_transfer_queue *GracefulExitTransferQueue, err error) { + + var __embed_stmt = __sqlbundle_Literal("SELECT graceful_exit_transfer_queue.node_id, graceful_exit_transfer_queue.path, graceful_exit_transfer_queue.piece_num, graceful_exit_transfer_queue.durability_ratio, graceful_exit_transfer_queue.queued_at, graceful_exit_transfer_queue.requested_at, graceful_exit_transfer_queue.last_failed_at, graceful_exit_transfer_queue.last_failed_code, graceful_exit_transfer_queue.failed_count, graceful_exit_transfer_queue.finished_at FROM graceful_exit_transfer_queue WHERE graceful_exit_transfer_queue.node_id = ? AND graceful_exit_transfer_queue.path = ?") + + var __values []interface{} + __values = append(__values, graceful_exit_transfer_queue_node_id.value(), graceful_exit_transfer_queue_path.value()) + + var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) + obj.logStmt(__stmt, __values...) + + graceful_exit_transfer_queue = &GracefulExitTransferQueue{} + err = obj.driver.QueryRow(__stmt, __values...).Scan(&graceful_exit_transfer_queue.NodeId, &graceful_exit_transfer_queue.Path, &graceful_exit_transfer_queue.PieceNum, &graceful_exit_transfer_queue.DurabilityRatio, &graceful_exit_transfer_queue.QueuedAt, &graceful_exit_transfer_queue.RequestedAt, &graceful_exit_transfer_queue.LastFailedAt, &graceful_exit_transfer_queue.LastFailedCode, &graceful_exit_transfer_queue.FailedCount, &graceful_exit_transfer_queue.FinishedAt) + if err != nil { + return nil, obj.makeErr(err) + } + return graceful_exit_transfer_queue, nil + +} + func (obj *postgresImpl) Update_PendingAudits_By_NodeId(ctx context.Context, pending_audits_node_id PendingAudits_NodeId_Field, update PendingAudits_Update_Fields) ( @@ -8114,7 +8731,7 @@ func (obj *postgresImpl) Update_Node_By_Id(ctx context.Context, node *Node, err error) { var __sets = &__sqlbundle_Hole{} - var __embed_stmt = __sqlbundle_Literals{Join: "", SQLs: []__sqlbundle_SQL{__sqlbundle_Literal("UPDATE nodes SET "), __sets, __sqlbundle_Literal(" WHERE nodes.id = ? RETURNING nodes.id, nodes.address, nodes.last_net, nodes.protocol, nodes.type, nodes.email, nodes.wallet, nodes.free_bandwidth, nodes.free_disk, nodes.piece_count, nodes.major, nodes.minor, nodes.patch, nodes.hash, nodes.timestamp, nodes.release, nodes.latency_90, nodes.audit_success_count, nodes.total_audit_count, nodes.uptime_success_count, nodes.total_uptime_count, nodes.created_at, nodes.updated_at, nodes.last_contact_success, nodes.last_contact_failure, nodes.contained, nodes.disqualified, nodes.audit_reputation_alpha, nodes.audit_reputation_beta, nodes.uptime_reputation_alpha, nodes.uptime_reputation_beta")}} + var __embed_stmt = __sqlbundle_Literals{Join: "", SQLs: []__sqlbundle_SQL{__sqlbundle_Literal("UPDATE nodes SET "), __sets, __sqlbundle_Literal(" WHERE nodes.id = ? RETURNING nodes.id, nodes.address, nodes.last_net, nodes.protocol, nodes.type, nodes.email, nodes.wallet, nodes.free_bandwidth, nodes.free_disk, nodes.piece_count, nodes.major, nodes.minor, nodes.patch, nodes.hash, nodes.timestamp, nodes.release, nodes.latency_90, nodes.audit_success_count, nodes.total_audit_count, nodes.uptime_success_count, nodes.total_uptime_count, nodes.created_at, nodes.updated_at, nodes.last_contact_success, nodes.last_contact_failure, nodes.contained, nodes.disqualified, nodes.audit_reputation_alpha, nodes.audit_reputation_beta, nodes.uptime_reputation_alpha, nodes.uptime_reputation_beta, nodes.exit_initiated_at, nodes.exit_loop_completed_at, nodes.exit_finished_at")}} __sets_sql := __sqlbundle_Literals{Join: ", "} var __values []interface{} @@ -8260,6 +8877,21 @@ func (obj *postgresImpl) Update_Node_By_Id(ctx context.Context, __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("uptime_reputation_beta = ?")) } + if update.ExitInitiatedAt._set { + __values = append(__values, update.ExitInitiatedAt.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("exit_initiated_at = ?")) + } + + if update.ExitLoopCompletedAt._set { + __values = append(__values, update.ExitLoopCompletedAt.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("exit_loop_completed_at = ?")) + } + + if update.ExitFinishedAt._set { + __values = append(__values, update.ExitFinishedAt.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("exit_finished_at = ?")) + } + __now := obj.db.Hooks.Now().UTC() __values = append(__values, __now) @@ -8274,7 +8906,7 @@ func (obj *postgresImpl) Update_Node_By_Id(ctx context.Context, obj.logStmt(__stmt, __values...) node = &Node{} - err = obj.driver.QueryRow(__stmt, __values...).Scan(&node.Id, &node.Address, &node.LastNet, &node.Protocol, &node.Type, &node.Email, &node.Wallet, &node.FreeBandwidth, &node.FreeDisk, &node.PieceCount, &node.Major, &node.Minor, &node.Patch, &node.Hash, &node.Timestamp, &node.Release, &node.Latency90, &node.AuditSuccessCount, &node.TotalAuditCount, &node.UptimeSuccessCount, &node.TotalUptimeCount, &node.CreatedAt, &node.UpdatedAt, &node.LastContactSuccess, &node.LastContactFailure, &node.Contained, &node.Disqualified, &node.AuditReputationAlpha, &node.AuditReputationBeta, &node.UptimeReputationAlpha, &node.UptimeReputationBeta) + err = obj.driver.QueryRow(__stmt, __values...).Scan(&node.Id, &node.Address, &node.LastNet, &node.Protocol, &node.Type, &node.Email, &node.Wallet, &node.FreeBandwidth, &node.FreeDisk, &node.PieceCount, &node.Major, &node.Minor, &node.Patch, &node.Hash, &node.Timestamp, &node.Release, &node.Latency90, &node.AuditSuccessCount, &node.TotalAuditCount, &node.UptimeSuccessCount, &node.TotalUptimeCount, &node.CreatedAt, &node.UpdatedAt, &node.LastContactSuccess, &node.LastContactFailure, &node.Contained, &node.Disqualified, &node.AuditReputationAlpha, &node.AuditReputationBeta, &node.UptimeReputationAlpha, &node.UptimeReputationBeta, &node.ExitInitiatedAt, &node.ExitLoopCompletedAt, &node.ExitFinishedAt) if err == sql.ErrNoRows { return nil, nil } @@ -8436,6 +9068,21 @@ func (obj *postgresImpl) UpdateNoReturn_Node_By_Id(ctx context.Context, __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("uptime_reputation_beta = ?")) } + if update.ExitInitiatedAt._set { + __values = append(__values, update.ExitInitiatedAt.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("exit_initiated_at = ?")) + } + + if update.ExitLoopCompletedAt._set { + __values = append(__values, update.ExitLoopCompletedAt.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("exit_loop_completed_at = ?")) + } + + if update.ExitFinishedAt._set { + __values = append(__values, update.ExitFinishedAt.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("exit_finished_at = ?")) + } + __now := obj.db.Hooks.Now().UTC() __values = append(__values, __now) @@ -8891,6 +9538,105 @@ func (obj *postgresImpl) Update_BucketMetainfo_By_ProjectId_And_Name(ctx context return bucket_metainfo, nil } +func (obj *postgresImpl) UpdateNoReturn_GracefulExitProgress_By_NodeId(ctx context.Context, + graceful_exit_progress_node_id GracefulExitProgress_NodeId_Field, + update GracefulExitProgress_Update_Fields) ( + err error) { + var __sets = &__sqlbundle_Hole{} + + var __embed_stmt = __sqlbundle_Literals{Join: "", SQLs: []__sqlbundle_SQL{__sqlbundle_Literal("UPDATE graceful_exit_progress SET "), __sets, __sqlbundle_Literal(" WHERE graceful_exit_progress.node_id = ?")}} + + __sets_sql := __sqlbundle_Literals{Join: ", "} + var __values []interface{} + var __args []interface{} + + if update.BytesTransferred._set { + __values = append(__values, update.BytesTransferred.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("bytes_transferred = ?")) + } + + __now := obj.db.Hooks.Now().UTC() + + __values = append(__values, __now) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("updated_at = ?")) + + __args = append(__args, graceful_exit_progress_node_id.value()) + + __values = append(__values, __args...) + __sets.SQL = __sets_sql + + var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) + obj.logStmt(__stmt, __values...) + + _, err = obj.driver.Exec(__stmt, __values...) + if err != nil { + return obj.makeErr(err) + } + return nil +} + +func (obj *postgresImpl) UpdateNoReturn_GracefulExitTransferQueue_By_NodeId_And_Path(ctx context.Context, + graceful_exit_transfer_queue_node_id GracefulExitTransferQueue_NodeId_Field, + graceful_exit_transfer_queue_path GracefulExitTransferQueue_Path_Field, + update GracefulExitTransferQueue_Update_Fields) ( + err error) { + var __sets = &__sqlbundle_Hole{} + + var __embed_stmt = __sqlbundle_Literals{Join: "", SQLs: []__sqlbundle_SQL{__sqlbundle_Literal("UPDATE graceful_exit_transfer_queue SET "), __sets, __sqlbundle_Literal(" WHERE graceful_exit_transfer_queue.node_id = ? AND graceful_exit_transfer_queue.path = ?")}} + + __sets_sql := __sqlbundle_Literals{Join: ", "} + var __values []interface{} + var __args []interface{} + + if update.DurabilityRatio._set { + __values = append(__values, update.DurabilityRatio.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("durability_ratio = ?")) + } + + if update.RequestedAt._set { + __values = append(__values, update.RequestedAt.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("requested_at = ?")) + } + + if update.LastFailedAt._set { + __values = append(__values, update.LastFailedAt.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("last_failed_at = ?")) + } + + if update.LastFailedCode._set { + __values = append(__values, update.LastFailedCode.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("last_failed_code = ?")) + } + + if update.FailedCount._set { + __values = append(__values, update.FailedCount.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("failed_count = ?")) + } + + if update.FinishedAt._set { + __values = append(__values, update.FinishedAt.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("finished_at = ?")) + } + + if len(__sets_sql.SQLs) == 0 { + return emptyUpdate() + } + + __args = append(__args, graceful_exit_transfer_queue_node_id.value(), graceful_exit_transfer_queue_path.value()) + + __values = append(__values, __args...) + __sets.SQL = __sets_sql + + var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) + obj.logStmt(__stmt, __values...) + + _, err = obj.driver.Exec(__stmt, __values...) + if err != nil { + return obj.makeErr(err) + } + return nil +} + func (obj *postgresImpl) Delete_ValueAttribution_By_ProjectId_And_BucketName(ctx context.Context, value_attribution_project_id ValueAttribution_ProjectId_Field, value_attribution_bucket_name ValueAttribution_BucketName_Field) ( @@ -9284,6 +10030,85 @@ func (obj *postgresImpl) Delete_BucketMetainfo_By_ProjectId_And_Name(ctx context } +func (obj *postgresImpl) Delete_GracefulExitProgress_By_NodeId(ctx context.Context, + graceful_exit_progress_node_id GracefulExitProgress_NodeId_Field) ( + deleted bool, err error) { + + var __embed_stmt = __sqlbundle_Literal("DELETE FROM graceful_exit_progress WHERE graceful_exit_progress.node_id = ?") + + var __values []interface{} + __values = append(__values, graceful_exit_progress_node_id.value()) + + var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) + obj.logStmt(__stmt, __values...) + + __res, err := obj.driver.Exec(__stmt, __values...) + if err != nil { + return false, obj.makeErr(err) + } + + __count, err := __res.RowsAffected() + if err != nil { + return false, obj.makeErr(err) + } + + return __count > 0, nil + +} + +func (obj *postgresImpl) Delete_GracefulExitTransferQueue_By_NodeId(ctx context.Context, + graceful_exit_transfer_queue_node_id GracefulExitTransferQueue_NodeId_Field) ( + count int64, err error) { + + var __embed_stmt = __sqlbundle_Literal("DELETE FROM graceful_exit_transfer_queue WHERE graceful_exit_transfer_queue.node_id = ?") + + var __values []interface{} + __values = append(__values, graceful_exit_transfer_queue_node_id.value()) + + var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) + obj.logStmt(__stmt, __values...) + + __res, err := obj.driver.Exec(__stmt, __values...) + if err != nil { + return 0, obj.makeErr(err) + } + + count, err = __res.RowsAffected() + if err != nil { + return 0, obj.makeErr(err) + } + + return count, nil + +} + +func (obj *postgresImpl) Delete_GracefulExitTransferQueue_By_NodeId_And_Path(ctx context.Context, + graceful_exit_transfer_queue_node_id GracefulExitTransferQueue_NodeId_Field, + graceful_exit_transfer_queue_path GracefulExitTransferQueue_Path_Field) ( + deleted bool, err error) { + + var __embed_stmt = __sqlbundle_Literal("DELETE FROM graceful_exit_transfer_queue WHERE graceful_exit_transfer_queue.node_id = ? AND graceful_exit_transfer_queue.path = ?") + + var __values []interface{} + __values = append(__values, graceful_exit_transfer_queue_node_id.value(), graceful_exit_transfer_queue_path.value()) + + var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) + obj.logStmt(__stmt, __values...) + + __res, err := obj.driver.Exec(__stmt, __values...) + if err != nil { + return false, obj.makeErr(err) + } + + __count, err := __res.RowsAffected() + if err != nil { + return false, obj.makeErr(err) + } + + return __count > 0, nil + +} + func (impl postgresImpl) isConstraintError(err error) ( constraint string, ok bool) { if e, ok := err.(*pq.Error); ok { @@ -9512,6 +10337,26 @@ func (obj *postgresImpl) deleteAll(ctx context.Context) (count int64, err error) return 0, obj.makeErr(err) } + __count, err = __res.RowsAffected() + if err != nil { + return 0, obj.makeErr(err) + } + count += __count + __res, err = obj.driver.Exec("DELETE FROM graceful_exit_transfer_queue;") + if err != nil { + return 0, obj.makeErr(err) + } + + __count, err = __res.RowsAffected() + if err != nil { + return 0, obj.makeErr(err) + } + count += __count + __res, err = obj.driver.Exec("DELETE FROM graceful_exit_progress;") + if err != nil { + return 0, obj.makeErr(err) + } + __count, err = __res.RowsAffected() if err != nil { return 0, obj.makeErr(err) @@ -9776,13 +10621,16 @@ func (obj *sqlite3Impl) CreateNoReturn_Node(ctx context.Context, __audit_reputation_beta_val := node_audit_reputation_beta.value() __uptime_reputation_alpha_val := node_uptime_reputation_alpha.value() __uptime_reputation_beta_val := node_uptime_reputation_beta.value() + __exit_initiated_at_val := optional.ExitInitiatedAt.value() + __exit_loop_completed_at_val := optional.ExitLoopCompletedAt.value() + __exit_finished_at_val := optional.ExitFinishedAt.value() - var __embed_stmt = __sqlbundle_Literal("INSERT INTO nodes ( id, address, last_net, protocol, type, email, wallet, free_bandwidth, free_disk, piece_count, major, minor, patch, hash, timestamp, release, latency_90, audit_success_count, total_audit_count, uptime_success_count, total_uptime_count, created_at, updated_at, last_contact_success, last_contact_failure, contained, disqualified, audit_reputation_alpha, audit_reputation_beta, uptime_reputation_alpha, uptime_reputation_beta ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )") + var __embed_stmt = __sqlbundle_Literal("INSERT INTO nodes ( id, address, last_net, protocol, type, email, wallet, free_bandwidth, free_disk, piece_count, major, minor, patch, hash, timestamp, release, latency_90, audit_success_count, total_audit_count, uptime_success_count, total_uptime_count, created_at, updated_at, last_contact_success, last_contact_failure, contained, disqualified, audit_reputation_alpha, audit_reputation_beta, uptime_reputation_alpha, uptime_reputation_beta, exit_initiated_at, exit_loop_completed_at, exit_finished_at ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )") var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) - obj.logStmt(__stmt, __id_val, __address_val, __last_net_val, __protocol_val, __type_val, __email_val, __wallet_val, __free_bandwidth_val, __free_disk_val, __piece_count_val, __major_val, __minor_val, __patch_val, __hash_val, __timestamp_val, __release_val, __latency_90_val, __audit_success_count_val, __total_audit_count_val, __uptime_success_count_val, __total_uptime_count_val, __created_at_val, __updated_at_val, __last_contact_success_val, __last_contact_failure_val, __contained_val, __disqualified_val, __audit_reputation_alpha_val, __audit_reputation_beta_val, __uptime_reputation_alpha_val, __uptime_reputation_beta_val) + obj.logStmt(__stmt, __id_val, __address_val, __last_net_val, __protocol_val, __type_val, __email_val, __wallet_val, __free_bandwidth_val, __free_disk_val, __piece_count_val, __major_val, __minor_val, __patch_val, __hash_val, __timestamp_val, __release_val, __latency_90_val, __audit_success_count_val, __total_audit_count_val, __uptime_success_count_val, __total_uptime_count_val, __created_at_val, __updated_at_val, __last_contact_success_val, __last_contact_failure_val, __contained_val, __disqualified_val, __audit_reputation_alpha_val, __audit_reputation_beta_val, __uptime_reputation_alpha_val, __uptime_reputation_beta_val, __exit_initiated_at_val, __exit_loop_completed_at_val, __exit_finished_at_val) - _, err = obj.driver.Exec(__stmt, __id_val, __address_val, __last_net_val, __protocol_val, __type_val, __email_val, __wallet_val, __free_bandwidth_val, __free_disk_val, __piece_count_val, __major_val, __minor_val, __patch_val, __hash_val, __timestamp_val, __release_val, __latency_90_val, __audit_success_count_val, __total_audit_count_val, __uptime_success_count_val, __total_uptime_count_val, __created_at_val, __updated_at_val, __last_contact_success_val, __last_contact_failure_val, __contained_val, __disqualified_val, __audit_reputation_alpha_val, __audit_reputation_beta_val, __uptime_reputation_alpha_val, __uptime_reputation_beta_val) + _, err = obj.driver.Exec(__stmt, __id_val, __address_val, __last_net_val, __protocol_val, __type_val, __email_val, __wallet_val, __free_bandwidth_val, __free_disk_val, __piece_count_val, __major_val, __minor_val, __patch_val, __hash_val, __timestamp_val, __release_val, __latency_90_val, __audit_success_count_val, __total_audit_count_val, __uptime_success_count_val, __total_uptime_count_val, __created_at_val, __updated_at_val, __last_contact_success_val, __last_contact_failure_val, __contained_val, __disqualified_val, __audit_reputation_alpha_val, __audit_reputation_beta_val, __uptime_reputation_alpha_val, __uptime_reputation_beta_val, __exit_initiated_at_val, __exit_loop_completed_at_val, __exit_finished_at_val) if err != nil { return obj.makeErr(err) } @@ -10365,6 +11213,62 @@ func (obj *sqlite3Impl) Create_BucketMetainfo(ctx context.Context, } +func (obj *sqlite3Impl) CreateNoReturn_GracefulExitProgress(ctx context.Context, + graceful_exit_progress_node_id GracefulExitProgress_NodeId_Field, + graceful_exit_progress_bytes_transferred GracefulExitProgress_BytesTransferred_Field) ( + err error) { + + __now := obj.db.Hooks.Now().UTC() + __node_id_val := graceful_exit_progress_node_id.value() + __bytes_transferred_val := graceful_exit_progress_bytes_transferred.value() + __updated_at_val := __now + + var __embed_stmt = __sqlbundle_Literal("INSERT INTO graceful_exit_progress ( node_id, bytes_transferred, updated_at ) VALUES ( ?, ?, ? )") + + var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) + obj.logStmt(__stmt, __node_id_val, __bytes_transferred_val, __updated_at_val) + + _, err = obj.driver.Exec(__stmt, __node_id_val, __bytes_transferred_val, __updated_at_val) + if err != nil { + return obj.makeErr(err) + } + return nil + +} + +func (obj *sqlite3Impl) CreateNoReturn_GracefulExitTransferQueue(ctx context.Context, + graceful_exit_transfer_queue_node_id GracefulExitTransferQueue_NodeId_Field, + graceful_exit_transfer_queue_path GracefulExitTransferQueue_Path_Field, + graceful_exit_transfer_queue_piece_num GracefulExitTransferQueue_PieceNum_Field, + graceful_exit_transfer_queue_durability_ratio GracefulExitTransferQueue_DurabilityRatio_Field, + optional GracefulExitTransferQueue_Create_Fields) ( + err error) { + + __now := obj.db.Hooks.Now().UTC() + __node_id_val := graceful_exit_transfer_queue_node_id.value() + __path_val := graceful_exit_transfer_queue_path.value() + __piece_num_val := graceful_exit_transfer_queue_piece_num.value() + __durability_ratio_val := graceful_exit_transfer_queue_durability_ratio.value() + __queued_at_val := __now + __requested_at_val := optional.RequestedAt.value() + __last_failed_at_val := optional.LastFailedAt.value() + __last_failed_code_val := optional.LastFailedCode.value() + __failed_count_val := optional.FailedCount.value() + __finished_at_val := optional.FinishedAt.value() + + var __embed_stmt = __sqlbundle_Literal("INSERT INTO graceful_exit_transfer_queue ( node_id, path, piece_num, durability_ratio, queued_at, requested_at, last_failed_at, last_failed_code, failed_count, finished_at ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )") + + var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) + obj.logStmt(__stmt, __node_id_val, __path_val, __piece_num_val, __durability_ratio_val, __queued_at_val, __requested_at_val, __last_failed_at_val, __last_failed_code_val, __failed_count_val, __finished_at_val) + + _, err = obj.driver.Exec(__stmt, __node_id_val, __path_val, __piece_num_val, __durability_ratio_val, __queued_at_val, __requested_at_val, __last_failed_at_val, __last_failed_code_val, __failed_count_val, __finished_at_val) + if err != nil { + return obj.makeErr(err) + } + return nil + +} + func (obj *sqlite3Impl) Get_ValueAttribution_By_ProjectId_And_BucketName(ctx context.Context, value_attribution_project_id ValueAttribution_ProjectId_Field, value_attribution_bucket_name ValueAttribution_BucketName_Field) ( @@ -10547,7 +11451,7 @@ func (obj *sqlite3Impl) Get_Node_By_Id(ctx context.Context, node_id Node_Id_Field) ( node *Node, err error) { - var __embed_stmt = __sqlbundle_Literal("SELECT nodes.id, nodes.address, nodes.last_net, nodes.protocol, nodes.type, nodes.email, nodes.wallet, nodes.free_bandwidth, nodes.free_disk, nodes.piece_count, nodes.major, nodes.minor, nodes.patch, nodes.hash, nodes.timestamp, nodes.release, nodes.latency_90, nodes.audit_success_count, nodes.total_audit_count, nodes.uptime_success_count, nodes.total_uptime_count, nodes.created_at, nodes.updated_at, nodes.last_contact_success, nodes.last_contact_failure, nodes.contained, nodes.disqualified, nodes.audit_reputation_alpha, nodes.audit_reputation_beta, nodes.uptime_reputation_alpha, nodes.uptime_reputation_beta FROM nodes WHERE nodes.id = ?") + var __embed_stmt = __sqlbundle_Literal("SELECT nodes.id, nodes.address, nodes.last_net, nodes.protocol, nodes.type, nodes.email, nodes.wallet, nodes.free_bandwidth, nodes.free_disk, nodes.piece_count, nodes.major, nodes.minor, nodes.patch, nodes.hash, nodes.timestamp, nodes.release, nodes.latency_90, nodes.audit_success_count, nodes.total_audit_count, nodes.uptime_success_count, nodes.total_uptime_count, nodes.created_at, nodes.updated_at, nodes.last_contact_success, nodes.last_contact_failure, nodes.contained, nodes.disqualified, nodes.audit_reputation_alpha, nodes.audit_reputation_beta, nodes.uptime_reputation_alpha, nodes.uptime_reputation_beta, nodes.exit_initiated_at, nodes.exit_loop_completed_at, nodes.exit_finished_at FROM nodes WHERE nodes.id = ?") var __values []interface{} __values = append(__values, node_id.value()) @@ -10556,7 +11460,7 @@ func (obj *sqlite3Impl) Get_Node_By_Id(ctx context.Context, obj.logStmt(__stmt, __values...) node = &Node{} - err = obj.driver.QueryRow(__stmt, __values...).Scan(&node.Id, &node.Address, &node.LastNet, &node.Protocol, &node.Type, &node.Email, &node.Wallet, &node.FreeBandwidth, &node.FreeDisk, &node.PieceCount, &node.Major, &node.Minor, &node.Patch, &node.Hash, &node.Timestamp, &node.Release, &node.Latency90, &node.AuditSuccessCount, &node.TotalAuditCount, &node.UptimeSuccessCount, &node.TotalUptimeCount, &node.CreatedAt, &node.UpdatedAt, &node.LastContactSuccess, &node.LastContactFailure, &node.Contained, &node.Disqualified, &node.AuditReputationAlpha, &node.AuditReputationBeta, &node.UptimeReputationAlpha, &node.UptimeReputationBeta) + err = obj.driver.QueryRow(__stmt, __values...).Scan(&node.Id, &node.Address, &node.LastNet, &node.Protocol, &node.Type, &node.Email, &node.Wallet, &node.FreeBandwidth, &node.FreeDisk, &node.PieceCount, &node.Major, &node.Minor, &node.Patch, &node.Hash, &node.Timestamp, &node.Release, &node.Latency90, &node.AuditSuccessCount, &node.TotalAuditCount, &node.UptimeSuccessCount, &node.TotalUptimeCount, &node.CreatedAt, &node.UpdatedAt, &node.LastContactSuccess, &node.LastContactFailure, &node.Contained, &node.Disqualified, &node.AuditReputationAlpha, &node.AuditReputationBeta, &node.UptimeReputationAlpha, &node.UptimeReputationBeta, &node.ExitInitiatedAt, &node.ExitLoopCompletedAt, &node.ExitFinishedAt) if err != nil { return nil, obj.makeErr(err) } @@ -10601,7 +11505,7 @@ func (obj *sqlite3Impl) Limited_Node_By_Id_GreaterOrEqual_OrderBy_Asc_Id(ctx con limit int, offset int64) ( rows []*Node, err error) { - var __embed_stmt = __sqlbundle_Literal("SELECT nodes.id, nodes.address, nodes.last_net, nodes.protocol, nodes.type, nodes.email, nodes.wallet, nodes.free_bandwidth, nodes.free_disk, nodes.piece_count, nodes.major, nodes.minor, nodes.patch, nodes.hash, nodes.timestamp, nodes.release, nodes.latency_90, nodes.audit_success_count, nodes.total_audit_count, nodes.uptime_success_count, nodes.total_uptime_count, nodes.created_at, nodes.updated_at, nodes.last_contact_success, nodes.last_contact_failure, nodes.contained, nodes.disqualified, nodes.audit_reputation_alpha, nodes.audit_reputation_beta, nodes.uptime_reputation_alpha, nodes.uptime_reputation_beta FROM nodes WHERE nodes.id >= ? ORDER BY nodes.id LIMIT ? OFFSET ?") + var __embed_stmt = __sqlbundle_Literal("SELECT nodes.id, nodes.address, nodes.last_net, nodes.protocol, nodes.type, nodes.email, nodes.wallet, nodes.free_bandwidth, nodes.free_disk, nodes.piece_count, nodes.major, nodes.minor, nodes.patch, nodes.hash, nodes.timestamp, nodes.release, nodes.latency_90, nodes.audit_success_count, nodes.total_audit_count, nodes.uptime_success_count, nodes.total_uptime_count, nodes.created_at, nodes.updated_at, nodes.last_contact_success, nodes.last_contact_failure, nodes.contained, nodes.disqualified, nodes.audit_reputation_alpha, nodes.audit_reputation_beta, nodes.uptime_reputation_alpha, nodes.uptime_reputation_beta, nodes.exit_initiated_at, nodes.exit_loop_completed_at, nodes.exit_finished_at FROM nodes WHERE nodes.id >= ? ORDER BY nodes.id LIMIT ? OFFSET ?") var __values []interface{} __values = append(__values, node_id_greater_or_equal.value()) @@ -10619,7 +11523,7 @@ func (obj *sqlite3Impl) Limited_Node_By_Id_GreaterOrEqual_OrderBy_Asc_Id(ctx con for __rows.Next() { node := &Node{} - err = __rows.Scan(&node.Id, &node.Address, &node.LastNet, &node.Protocol, &node.Type, &node.Email, &node.Wallet, &node.FreeBandwidth, &node.FreeDisk, &node.PieceCount, &node.Major, &node.Minor, &node.Patch, &node.Hash, &node.Timestamp, &node.Release, &node.Latency90, &node.AuditSuccessCount, &node.TotalAuditCount, &node.UptimeSuccessCount, &node.TotalUptimeCount, &node.CreatedAt, &node.UpdatedAt, &node.LastContactSuccess, &node.LastContactFailure, &node.Contained, &node.Disqualified, &node.AuditReputationAlpha, &node.AuditReputationBeta, &node.UptimeReputationAlpha, &node.UptimeReputationBeta) + err = __rows.Scan(&node.Id, &node.Address, &node.LastNet, &node.Protocol, &node.Type, &node.Email, &node.Wallet, &node.FreeBandwidth, &node.FreeDisk, &node.PieceCount, &node.Major, &node.Minor, &node.Patch, &node.Hash, &node.Timestamp, &node.Release, &node.Latency90, &node.AuditSuccessCount, &node.TotalAuditCount, &node.UptimeSuccessCount, &node.TotalUptimeCount, &node.CreatedAt, &node.UpdatedAt, &node.LastContactSuccess, &node.LastContactFailure, &node.Contained, &node.Disqualified, &node.AuditReputationAlpha, &node.AuditReputationBeta, &node.UptimeReputationAlpha, &node.UptimeReputationBeta, &node.ExitInitiatedAt, &node.ExitLoopCompletedAt, &node.ExitFinishedAt) if err != nil { return nil, obj.makeErr(err) } @@ -12014,6 +12918,49 @@ func (obj *sqlite3Impl) Limited_BucketMetainfo_By_ProjectId_And_Name_Greater_Ord } +func (obj *sqlite3Impl) Get_GracefulExitProgress_By_NodeId(ctx context.Context, + graceful_exit_progress_node_id GracefulExitProgress_NodeId_Field) ( + graceful_exit_progress *GracefulExitProgress, err error) { + + var __embed_stmt = __sqlbundle_Literal("SELECT graceful_exit_progress.node_id, graceful_exit_progress.bytes_transferred, graceful_exit_progress.updated_at FROM graceful_exit_progress WHERE graceful_exit_progress.node_id = ?") + + var __values []interface{} + __values = append(__values, graceful_exit_progress_node_id.value()) + + var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) + obj.logStmt(__stmt, __values...) + + graceful_exit_progress = &GracefulExitProgress{} + err = obj.driver.QueryRow(__stmt, __values...).Scan(&graceful_exit_progress.NodeId, &graceful_exit_progress.BytesTransferred, &graceful_exit_progress.UpdatedAt) + if err != nil { + return nil, obj.makeErr(err) + } + return graceful_exit_progress, nil + +} + +func (obj *sqlite3Impl) Get_GracefulExitTransferQueue_By_NodeId_And_Path(ctx context.Context, + graceful_exit_transfer_queue_node_id GracefulExitTransferQueue_NodeId_Field, + graceful_exit_transfer_queue_path GracefulExitTransferQueue_Path_Field) ( + graceful_exit_transfer_queue *GracefulExitTransferQueue, err error) { + + var __embed_stmt = __sqlbundle_Literal("SELECT graceful_exit_transfer_queue.node_id, graceful_exit_transfer_queue.path, graceful_exit_transfer_queue.piece_num, graceful_exit_transfer_queue.durability_ratio, graceful_exit_transfer_queue.queued_at, graceful_exit_transfer_queue.requested_at, graceful_exit_transfer_queue.last_failed_at, graceful_exit_transfer_queue.last_failed_code, graceful_exit_transfer_queue.failed_count, graceful_exit_transfer_queue.finished_at FROM graceful_exit_transfer_queue WHERE graceful_exit_transfer_queue.node_id = ? AND graceful_exit_transfer_queue.path = ?") + + var __values []interface{} + __values = append(__values, graceful_exit_transfer_queue_node_id.value(), graceful_exit_transfer_queue_path.value()) + + var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) + obj.logStmt(__stmt, __values...) + + graceful_exit_transfer_queue = &GracefulExitTransferQueue{} + err = obj.driver.QueryRow(__stmt, __values...).Scan(&graceful_exit_transfer_queue.NodeId, &graceful_exit_transfer_queue.Path, &graceful_exit_transfer_queue.PieceNum, &graceful_exit_transfer_queue.DurabilityRatio, &graceful_exit_transfer_queue.QueuedAt, &graceful_exit_transfer_queue.RequestedAt, &graceful_exit_transfer_queue.LastFailedAt, &graceful_exit_transfer_queue.LastFailedCode, &graceful_exit_transfer_queue.FailedCount, &graceful_exit_transfer_queue.FinishedAt) + if err != nil { + return nil, obj.makeErr(err) + } + return graceful_exit_transfer_queue, nil + +} + func (obj *sqlite3Impl) Update_PendingAudits_By_NodeId(ctx context.Context, pending_audits_node_id PendingAudits_NodeId_Field, update PendingAudits_Update_Fields) ( @@ -12303,6 +13250,21 @@ func (obj *sqlite3Impl) Update_Node_By_Id(ctx context.Context, __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("uptime_reputation_beta = ?")) } + if update.ExitInitiatedAt._set { + __values = append(__values, update.ExitInitiatedAt.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("exit_initiated_at = ?")) + } + + if update.ExitLoopCompletedAt._set { + __values = append(__values, update.ExitLoopCompletedAt.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("exit_loop_completed_at = ?")) + } + + if update.ExitFinishedAt._set { + __values = append(__values, update.ExitFinishedAt.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("exit_finished_at = ?")) + } + __now := obj.db.Hooks.Now().UTC() __values = append(__values, __now) @@ -12322,12 +13284,12 @@ func (obj *sqlite3Impl) Update_Node_By_Id(ctx context.Context, return nil, obj.makeErr(err) } - var __embed_stmt_get = __sqlbundle_Literal("SELECT nodes.id, nodes.address, nodes.last_net, nodes.protocol, nodes.type, nodes.email, nodes.wallet, nodes.free_bandwidth, nodes.free_disk, nodes.piece_count, nodes.major, nodes.minor, nodes.patch, nodes.hash, nodes.timestamp, nodes.release, nodes.latency_90, nodes.audit_success_count, nodes.total_audit_count, nodes.uptime_success_count, nodes.total_uptime_count, nodes.created_at, nodes.updated_at, nodes.last_contact_success, nodes.last_contact_failure, nodes.contained, nodes.disqualified, nodes.audit_reputation_alpha, nodes.audit_reputation_beta, nodes.uptime_reputation_alpha, nodes.uptime_reputation_beta FROM nodes WHERE nodes.id = ?") + var __embed_stmt_get = __sqlbundle_Literal("SELECT nodes.id, nodes.address, nodes.last_net, nodes.protocol, nodes.type, nodes.email, nodes.wallet, nodes.free_bandwidth, nodes.free_disk, nodes.piece_count, nodes.major, nodes.minor, nodes.patch, nodes.hash, nodes.timestamp, nodes.release, nodes.latency_90, nodes.audit_success_count, nodes.total_audit_count, nodes.uptime_success_count, nodes.total_uptime_count, nodes.created_at, nodes.updated_at, nodes.last_contact_success, nodes.last_contact_failure, nodes.contained, nodes.disqualified, nodes.audit_reputation_alpha, nodes.audit_reputation_beta, nodes.uptime_reputation_alpha, nodes.uptime_reputation_beta, nodes.exit_initiated_at, nodes.exit_loop_completed_at, nodes.exit_finished_at FROM nodes WHERE nodes.id = ?") var __stmt_get = __sqlbundle_Render(obj.dialect, __embed_stmt_get) obj.logStmt("(IMPLIED) "+__stmt_get, __args...) - err = obj.driver.QueryRow(__stmt_get, __args...).Scan(&node.Id, &node.Address, &node.LastNet, &node.Protocol, &node.Type, &node.Email, &node.Wallet, &node.FreeBandwidth, &node.FreeDisk, &node.PieceCount, &node.Major, &node.Minor, &node.Patch, &node.Hash, &node.Timestamp, &node.Release, &node.Latency90, &node.AuditSuccessCount, &node.TotalAuditCount, &node.UptimeSuccessCount, &node.TotalUptimeCount, &node.CreatedAt, &node.UpdatedAt, &node.LastContactSuccess, &node.LastContactFailure, &node.Contained, &node.Disqualified, &node.AuditReputationAlpha, &node.AuditReputationBeta, &node.UptimeReputationAlpha, &node.UptimeReputationBeta) + err = obj.driver.QueryRow(__stmt_get, __args...).Scan(&node.Id, &node.Address, &node.LastNet, &node.Protocol, &node.Type, &node.Email, &node.Wallet, &node.FreeBandwidth, &node.FreeDisk, &node.PieceCount, &node.Major, &node.Minor, &node.Patch, &node.Hash, &node.Timestamp, &node.Release, &node.Latency90, &node.AuditSuccessCount, &node.TotalAuditCount, &node.UptimeSuccessCount, &node.TotalUptimeCount, &node.CreatedAt, &node.UpdatedAt, &node.LastContactSuccess, &node.LastContactFailure, &node.Contained, &node.Disqualified, &node.AuditReputationAlpha, &node.AuditReputationBeta, &node.UptimeReputationAlpha, &node.UptimeReputationBeta, &node.ExitInitiatedAt, &node.ExitLoopCompletedAt, &node.ExitFinishedAt) if err == sql.ErrNoRows { return nil, nil } @@ -12489,6 +13451,21 @@ func (obj *sqlite3Impl) UpdateNoReturn_Node_By_Id(ctx context.Context, __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("uptime_reputation_beta = ?")) } + if update.ExitInitiatedAt._set { + __values = append(__values, update.ExitInitiatedAt.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("exit_initiated_at = ?")) + } + + if update.ExitLoopCompletedAt._set { + __values = append(__values, update.ExitLoopCompletedAt.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("exit_loop_completed_at = ?")) + } + + if update.ExitFinishedAt._set { + __values = append(__values, update.ExitFinishedAt.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("exit_finished_at = ?")) + } + __now := obj.db.Hooks.Now().UTC() __values = append(__values, __now) @@ -12994,6 +13971,105 @@ func (obj *sqlite3Impl) Update_BucketMetainfo_By_ProjectId_And_Name(ctx context. return bucket_metainfo, nil } +func (obj *sqlite3Impl) UpdateNoReturn_GracefulExitProgress_By_NodeId(ctx context.Context, + graceful_exit_progress_node_id GracefulExitProgress_NodeId_Field, + update GracefulExitProgress_Update_Fields) ( + err error) { + var __sets = &__sqlbundle_Hole{} + + var __embed_stmt = __sqlbundle_Literals{Join: "", SQLs: []__sqlbundle_SQL{__sqlbundle_Literal("UPDATE graceful_exit_progress SET "), __sets, __sqlbundle_Literal(" WHERE graceful_exit_progress.node_id = ?")}} + + __sets_sql := __sqlbundle_Literals{Join: ", "} + var __values []interface{} + var __args []interface{} + + if update.BytesTransferred._set { + __values = append(__values, update.BytesTransferred.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("bytes_transferred = ?")) + } + + __now := obj.db.Hooks.Now().UTC() + + __values = append(__values, __now) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("updated_at = ?")) + + __args = append(__args, graceful_exit_progress_node_id.value()) + + __values = append(__values, __args...) + __sets.SQL = __sets_sql + + var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) + obj.logStmt(__stmt, __values...) + + _, err = obj.driver.Exec(__stmt, __values...) + if err != nil { + return obj.makeErr(err) + } + return nil +} + +func (obj *sqlite3Impl) UpdateNoReturn_GracefulExitTransferQueue_By_NodeId_And_Path(ctx context.Context, + graceful_exit_transfer_queue_node_id GracefulExitTransferQueue_NodeId_Field, + graceful_exit_transfer_queue_path GracefulExitTransferQueue_Path_Field, + update GracefulExitTransferQueue_Update_Fields) ( + err error) { + var __sets = &__sqlbundle_Hole{} + + var __embed_stmt = __sqlbundle_Literals{Join: "", SQLs: []__sqlbundle_SQL{__sqlbundle_Literal("UPDATE graceful_exit_transfer_queue SET "), __sets, __sqlbundle_Literal(" WHERE graceful_exit_transfer_queue.node_id = ? AND graceful_exit_transfer_queue.path = ?")}} + + __sets_sql := __sqlbundle_Literals{Join: ", "} + var __values []interface{} + var __args []interface{} + + if update.DurabilityRatio._set { + __values = append(__values, update.DurabilityRatio.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("durability_ratio = ?")) + } + + if update.RequestedAt._set { + __values = append(__values, update.RequestedAt.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("requested_at = ?")) + } + + if update.LastFailedAt._set { + __values = append(__values, update.LastFailedAt.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("last_failed_at = ?")) + } + + if update.LastFailedCode._set { + __values = append(__values, update.LastFailedCode.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("last_failed_code = ?")) + } + + if update.FailedCount._set { + __values = append(__values, update.FailedCount.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("failed_count = ?")) + } + + if update.FinishedAt._set { + __values = append(__values, update.FinishedAt.value()) + __sets_sql.SQLs = append(__sets_sql.SQLs, __sqlbundle_Literal("finished_at = ?")) + } + + if len(__sets_sql.SQLs) == 0 { + return emptyUpdate() + } + + __args = append(__args, graceful_exit_transfer_queue_node_id.value(), graceful_exit_transfer_queue_path.value()) + + __values = append(__values, __args...) + __sets.SQL = __sets_sql + + var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) + obj.logStmt(__stmt, __values...) + + _, err = obj.driver.Exec(__stmt, __values...) + if err != nil { + return obj.makeErr(err) + } + return nil +} + func (obj *sqlite3Impl) Delete_ValueAttribution_By_ProjectId_And_BucketName(ctx context.Context, value_attribution_project_id ValueAttribution_ProjectId_Field, value_attribution_bucket_name ValueAttribution_BucketName_Field) ( @@ -13387,6 +14463,85 @@ func (obj *sqlite3Impl) Delete_BucketMetainfo_By_ProjectId_And_Name(ctx context. } +func (obj *sqlite3Impl) Delete_GracefulExitProgress_By_NodeId(ctx context.Context, + graceful_exit_progress_node_id GracefulExitProgress_NodeId_Field) ( + deleted bool, err error) { + + var __embed_stmt = __sqlbundle_Literal("DELETE FROM graceful_exit_progress WHERE graceful_exit_progress.node_id = ?") + + var __values []interface{} + __values = append(__values, graceful_exit_progress_node_id.value()) + + var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) + obj.logStmt(__stmt, __values...) + + __res, err := obj.driver.Exec(__stmt, __values...) + if err != nil { + return false, obj.makeErr(err) + } + + __count, err := __res.RowsAffected() + if err != nil { + return false, obj.makeErr(err) + } + + return __count > 0, nil + +} + +func (obj *sqlite3Impl) Delete_GracefulExitTransferQueue_By_NodeId(ctx context.Context, + graceful_exit_transfer_queue_node_id GracefulExitTransferQueue_NodeId_Field) ( + count int64, err error) { + + var __embed_stmt = __sqlbundle_Literal("DELETE FROM graceful_exit_transfer_queue WHERE graceful_exit_transfer_queue.node_id = ?") + + var __values []interface{} + __values = append(__values, graceful_exit_transfer_queue_node_id.value()) + + var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) + obj.logStmt(__stmt, __values...) + + __res, err := obj.driver.Exec(__stmt, __values...) + if err != nil { + return 0, obj.makeErr(err) + } + + count, err = __res.RowsAffected() + if err != nil { + return 0, obj.makeErr(err) + } + + return count, nil + +} + +func (obj *sqlite3Impl) Delete_GracefulExitTransferQueue_By_NodeId_And_Path(ctx context.Context, + graceful_exit_transfer_queue_node_id GracefulExitTransferQueue_NodeId_Field, + graceful_exit_transfer_queue_path GracefulExitTransferQueue_Path_Field) ( + deleted bool, err error) { + + var __embed_stmt = __sqlbundle_Literal("DELETE FROM graceful_exit_transfer_queue WHERE graceful_exit_transfer_queue.node_id = ? AND graceful_exit_transfer_queue.path = ?") + + var __values []interface{} + __values = append(__values, graceful_exit_transfer_queue_node_id.value(), graceful_exit_transfer_queue_path.value()) + + var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) + obj.logStmt(__stmt, __values...) + + __res, err := obj.driver.Exec(__stmt, __values...) + if err != nil { + return false, obj.makeErr(err) + } + + __count, err := __res.RowsAffected() + if err != nil { + return false, obj.makeErr(err) + } + + return __count > 0, nil + +} + func (obj *sqlite3Impl) getLastValueAttribution(ctx context.Context, pk int64) ( value_attribution *ValueAttribution, err error) { @@ -13481,13 +14636,13 @@ func (obj *sqlite3Impl) getLastNode(ctx context.Context, pk int64) ( node *Node, err error) { - var __embed_stmt = __sqlbundle_Literal("SELECT nodes.id, nodes.address, nodes.last_net, nodes.protocol, nodes.type, nodes.email, nodes.wallet, nodes.free_bandwidth, nodes.free_disk, nodes.piece_count, nodes.major, nodes.minor, nodes.patch, nodes.hash, nodes.timestamp, nodes.release, nodes.latency_90, nodes.audit_success_count, nodes.total_audit_count, nodes.uptime_success_count, nodes.total_uptime_count, nodes.created_at, nodes.updated_at, nodes.last_contact_success, nodes.last_contact_failure, nodes.contained, nodes.disqualified, nodes.audit_reputation_alpha, nodes.audit_reputation_beta, nodes.uptime_reputation_alpha, nodes.uptime_reputation_beta FROM nodes WHERE _rowid_ = ?") + var __embed_stmt = __sqlbundle_Literal("SELECT nodes.id, nodes.address, nodes.last_net, nodes.protocol, nodes.type, nodes.email, nodes.wallet, nodes.free_bandwidth, nodes.free_disk, nodes.piece_count, nodes.major, nodes.minor, nodes.patch, nodes.hash, nodes.timestamp, nodes.release, nodes.latency_90, nodes.audit_success_count, nodes.total_audit_count, nodes.uptime_success_count, nodes.total_uptime_count, nodes.created_at, nodes.updated_at, nodes.last_contact_success, nodes.last_contact_failure, nodes.contained, nodes.disqualified, nodes.audit_reputation_alpha, nodes.audit_reputation_beta, nodes.uptime_reputation_alpha, nodes.uptime_reputation_beta, nodes.exit_initiated_at, nodes.exit_loop_completed_at, nodes.exit_finished_at FROM nodes WHERE _rowid_ = ?") var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, pk) node = &Node{} - err = obj.driver.QueryRow(__stmt, pk).Scan(&node.Id, &node.Address, &node.LastNet, &node.Protocol, &node.Type, &node.Email, &node.Wallet, &node.FreeBandwidth, &node.FreeDisk, &node.PieceCount, &node.Major, &node.Minor, &node.Patch, &node.Hash, &node.Timestamp, &node.Release, &node.Latency90, &node.AuditSuccessCount, &node.TotalAuditCount, &node.UptimeSuccessCount, &node.TotalUptimeCount, &node.CreatedAt, &node.UpdatedAt, &node.LastContactSuccess, &node.LastContactFailure, &node.Contained, &node.Disqualified, &node.AuditReputationAlpha, &node.AuditReputationBeta, &node.UptimeReputationAlpha, &node.UptimeReputationBeta) + err = obj.driver.QueryRow(__stmt, pk).Scan(&node.Id, &node.Address, &node.LastNet, &node.Protocol, &node.Type, &node.Email, &node.Wallet, &node.FreeBandwidth, &node.FreeDisk, &node.PieceCount, &node.Major, &node.Minor, &node.Patch, &node.Hash, &node.Timestamp, &node.Release, &node.Latency90, &node.AuditSuccessCount, &node.TotalAuditCount, &node.UptimeSuccessCount, &node.TotalUptimeCount, &node.CreatedAt, &node.UpdatedAt, &node.LastContactSuccess, &node.LastContactFailure, &node.Contained, &node.Disqualified, &node.AuditReputationAlpha, &node.AuditReputationBeta, &node.UptimeReputationAlpha, &node.UptimeReputationBeta, &node.ExitInitiatedAt, &node.ExitLoopCompletedAt, &node.ExitFinishedAt) if err != nil { return nil, obj.makeErr(err) } @@ -13819,6 +14974,42 @@ func (obj *sqlite3Impl) getLastBucketMetainfo(ctx context.Context, } +func (obj *sqlite3Impl) getLastGracefulExitProgress(ctx context.Context, + pk int64) ( + graceful_exit_progress *GracefulExitProgress, err error) { + + var __embed_stmt = __sqlbundle_Literal("SELECT graceful_exit_progress.node_id, graceful_exit_progress.bytes_transferred, graceful_exit_progress.updated_at FROM graceful_exit_progress WHERE _rowid_ = ?") + + var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) + obj.logStmt(__stmt, pk) + + graceful_exit_progress = &GracefulExitProgress{} + err = obj.driver.QueryRow(__stmt, pk).Scan(&graceful_exit_progress.NodeId, &graceful_exit_progress.BytesTransferred, &graceful_exit_progress.UpdatedAt) + if err != nil { + return nil, obj.makeErr(err) + } + return graceful_exit_progress, nil + +} + +func (obj *sqlite3Impl) getLastGracefulExitTransferQueue(ctx context.Context, + pk int64) ( + graceful_exit_transfer_queue *GracefulExitTransferQueue, err error) { + + var __embed_stmt = __sqlbundle_Literal("SELECT graceful_exit_transfer_queue.node_id, graceful_exit_transfer_queue.path, graceful_exit_transfer_queue.piece_num, graceful_exit_transfer_queue.durability_ratio, graceful_exit_transfer_queue.queued_at, graceful_exit_transfer_queue.requested_at, graceful_exit_transfer_queue.last_failed_at, graceful_exit_transfer_queue.last_failed_code, graceful_exit_transfer_queue.failed_count, graceful_exit_transfer_queue.finished_at FROM graceful_exit_transfer_queue WHERE _rowid_ = ?") + + var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) + obj.logStmt(__stmt, pk) + + graceful_exit_transfer_queue = &GracefulExitTransferQueue{} + err = obj.driver.QueryRow(__stmt, pk).Scan(&graceful_exit_transfer_queue.NodeId, &graceful_exit_transfer_queue.Path, &graceful_exit_transfer_queue.PieceNum, &graceful_exit_transfer_queue.DurabilityRatio, &graceful_exit_transfer_queue.QueuedAt, &graceful_exit_transfer_queue.RequestedAt, &graceful_exit_transfer_queue.LastFailedAt, &graceful_exit_transfer_queue.LastFailedCode, &graceful_exit_transfer_queue.FailedCount, &graceful_exit_transfer_queue.FinishedAt) + if err != nil { + return nil, obj.makeErr(err) + } + return graceful_exit_transfer_queue, nil + +} + func (impl sqlite3Impl) isConstraintError(err error) ( constraint string, ok bool) { if e, ok := err.(sqlite3.Error); ok { @@ -14052,6 +15243,26 @@ func (obj *sqlite3Impl) deleteAll(ctx context.Context) (count int64, err error) return 0, obj.makeErr(err) } + __count, err = __res.RowsAffected() + if err != nil { + return 0, obj.makeErr(err) + } + count += __count + __res, err = obj.driver.Exec("DELETE FROM graceful_exit_transfer_queue;") + if err != nil { + return 0, obj.makeErr(err) + } + + __count, err = __res.RowsAffected() + if err != nil { + return 0, obj.makeErr(err) + } + count += __count + __res, err = obj.driver.Exec("DELETE FROM graceful_exit_progress;") + if err != nil { + return 0, obj.makeErr(err) + } + __count, err = __res.RowsAffected() if err != nil { return 0, obj.makeErr(err) @@ -14391,6 +15602,33 @@ func (rx *Rx) CreateNoReturn_BucketStorageTally(ctx context.Context, } +func (rx *Rx) CreateNoReturn_GracefulExitProgress(ctx context.Context, + graceful_exit_progress_node_id GracefulExitProgress_NodeId_Field, + graceful_exit_progress_bytes_transferred GracefulExitProgress_BytesTransferred_Field) ( + err error) { + var tx *Tx + if tx, err = rx.getTx(ctx); err != nil { + return + } + return tx.CreateNoReturn_GracefulExitProgress(ctx, graceful_exit_progress_node_id, graceful_exit_progress_bytes_transferred) + +} + +func (rx *Rx) CreateNoReturn_GracefulExitTransferQueue(ctx context.Context, + graceful_exit_transfer_queue_node_id GracefulExitTransferQueue_NodeId_Field, + graceful_exit_transfer_queue_path GracefulExitTransferQueue_Path_Field, + graceful_exit_transfer_queue_piece_num GracefulExitTransferQueue_PieceNum_Field, + graceful_exit_transfer_queue_durability_ratio GracefulExitTransferQueue_DurabilityRatio_Field, + optional GracefulExitTransferQueue_Create_Fields) ( + err error) { + var tx *Tx + if tx, err = rx.getTx(ctx); err != nil { + return + } + return tx.CreateNoReturn_GracefulExitTransferQueue(ctx, graceful_exit_transfer_queue_node_id, graceful_exit_transfer_queue_path, graceful_exit_transfer_queue_piece_num, graceful_exit_transfer_queue_durability_ratio, optional) + +} + func (rx *Rx) CreateNoReturn_Irreparabledb(ctx context.Context, irreparabledb_segmentpath Irreparabledb_Segmentpath_Field, irreparabledb_segmentdetail Irreparabledb_Segmentdetail_Field, @@ -14773,6 +16011,38 @@ func (rx *Rx) Delete_BucketUsage_By_Id(ctx context.Context, return tx.Delete_BucketUsage_By_Id(ctx, bucket_usage_id) } +func (rx *Rx) Delete_GracefulExitProgress_By_NodeId(ctx context.Context, + graceful_exit_progress_node_id GracefulExitProgress_NodeId_Field) ( + deleted bool, err error) { + var tx *Tx + if tx, err = rx.getTx(ctx); err != nil { + return + } + return tx.Delete_GracefulExitProgress_By_NodeId(ctx, graceful_exit_progress_node_id) +} + +func (rx *Rx) Delete_GracefulExitTransferQueue_By_NodeId(ctx context.Context, + graceful_exit_transfer_queue_node_id GracefulExitTransferQueue_NodeId_Field) ( + count int64, err error) { + var tx *Tx + if tx, err = rx.getTx(ctx); err != nil { + return + } + return tx.Delete_GracefulExitTransferQueue_By_NodeId(ctx, graceful_exit_transfer_queue_node_id) + +} + +func (rx *Rx) Delete_GracefulExitTransferQueue_By_NodeId_And_Path(ctx context.Context, + graceful_exit_transfer_queue_node_id GracefulExitTransferQueue_NodeId_Field, + graceful_exit_transfer_queue_path GracefulExitTransferQueue_Path_Field) ( + deleted bool, err error) { + var tx *Tx + if tx, err = rx.getTx(ctx); err != nil { + return + } + return tx.Delete_GracefulExitTransferQueue_By_NodeId_And_Path(ctx, graceful_exit_transfer_queue_node_id, graceful_exit_transfer_queue_path) +} + func (rx *Rx) Delete_Irreparabledb_By_Segmentpath(ctx context.Context, irreparabledb_segmentpath Irreparabledb_Segmentpath_Field) ( deleted bool, err error) { @@ -14992,6 +16262,27 @@ func (rx *Rx) Get_BucketUsage_By_Id(ctx context.Context, return tx.Get_BucketUsage_By_Id(ctx, bucket_usage_id) } +func (rx *Rx) Get_GracefulExitProgress_By_NodeId(ctx context.Context, + graceful_exit_progress_node_id GracefulExitProgress_NodeId_Field) ( + graceful_exit_progress *GracefulExitProgress, err error) { + var tx *Tx + if tx, err = rx.getTx(ctx); err != nil { + return + } + return tx.Get_GracefulExitProgress_By_NodeId(ctx, graceful_exit_progress_node_id) +} + +func (rx *Rx) Get_GracefulExitTransferQueue_By_NodeId_And_Path(ctx context.Context, + graceful_exit_transfer_queue_node_id GracefulExitTransferQueue_NodeId_Field, + graceful_exit_transfer_queue_path GracefulExitTransferQueue_Path_Field) ( + graceful_exit_transfer_queue *GracefulExitTransferQueue, err error) { + var tx *Tx + if tx, err = rx.getTx(ctx); err != nil { + return + } + return tx.Get_GracefulExitTransferQueue_By_NodeId_And_Path(ctx, graceful_exit_transfer_queue_node_id, graceful_exit_transfer_queue_path) +} + func (rx *Rx) Get_Irreparabledb_By_Segmentpath(ctx context.Context, irreparabledb_segmentpath Irreparabledb_Segmentpath_Field) ( irreparabledb *Irreparabledb, err error) { @@ -15300,6 +16591,29 @@ func (rx *Rx) UpdateNoReturn_ApiKey_By_Id(ctx context.Context, return tx.UpdateNoReturn_ApiKey_By_Id(ctx, api_key_id, update) } +func (rx *Rx) UpdateNoReturn_GracefulExitProgress_By_NodeId(ctx context.Context, + graceful_exit_progress_node_id GracefulExitProgress_NodeId_Field, + update GracefulExitProgress_Update_Fields) ( + err error) { + var tx *Tx + if tx, err = rx.getTx(ctx); err != nil { + return + } + return tx.UpdateNoReturn_GracefulExitProgress_By_NodeId(ctx, graceful_exit_progress_node_id, update) +} + +func (rx *Rx) UpdateNoReturn_GracefulExitTransferQueue_By_NodeId_And_Path(ctx context.Context, + graceful_exit_transfer_queue_node_id GracefulExitTransferQueue_NodeId_Field, + graceful_exit_transfer_queue_path GracefulExitTransferQueue_Path_Field, + update GracefulExitTransferQueue_Update_Fields) ( + err error) { + var tx *Tx + if tx, err = rx.getTx(ctx); err != nil { + return + } + return tx.UpdateNoReturn_GracefulExitTransferQueue_By_NodeId_And_Path(ctx, graceful_exit_transfer_queue_node_id, graceful_exit_transfer_queue_path, update) +} + func (rx *Rx) UpdateNoReturn_Irreparabledb_By_Segmentpath(ctx context.Context, irreparabledb_segmentpath Irreparabledb_Segmentpath_Field, update Irreparabledb_Update_Fields) ( @@ -15525,6 +16839,19 @@ type Methods interface { bucket_storage_tally_metadata_size BucketStorageTally_MetadataSize_Field) ( err error) + CreateNoReturn_GracefulExitProgress(ctx context.Context, + graceful_exit_progress_node_id GracefulExitProgress_NodeId_Field, + graceful_exit_progress_bytes_transferred GracefulExitProgress_BytesTransferred_Field) ( + err error) + + CreateNoReturn_GracefulExitTransferQueue(ctx context.Context, + graceful_exit_transfer_queue_node_id GracefulExitTransferQueue_NodeId_Field, + graceful_exit_transfer_queue_path GracefulExitTransferQueue_Path_Field, + graceful_exit_transfer_queue_piece_num GracefulExitTransferQueue_PieceNum_Field, + graceful_exit_transfer_queue_durability_ratio GracefulExitTransferQueue_DurabilityRatio_Field, + optional GracefulExitTransferQueue_Create_Fields) ( + err error) + CreateNoReturn_Irreparabledb(ctx context.Context, irreparabledb_segmentpath Irreparabledb_Segmentpath_Field, irreparabledb_segmentdetail Irreparabledb_Segmentdetail_Field, @@ -15736,6 +17063,19 @@ type Methods interface { bucket_usage_id BucketUsage_Id_Field) ( deleted bool, err error) + Delete_GracefulExitProgress_By_NodeId(ctx context.Context, + graceful_exit_progress_node_id GracefulExitProgress_NodeId_Field) ( + deleted bool, err error) + + Delete_GracefulExitTransferQueue_By_NodeId(ctx context.Context, + graceful_exit_transfer_queue_node_id GracefulExitTransferQueue_NodeId_Field) ( + count int64, err error) + + Delete_GracefulExitTransferQueue_By_NodeId_And_Path(ctx context.Context, + graceful_exit_transfer_queue_node_id GracefulExitTransferQueue_NodeId_Field, + graceful_exit_transfer_queue_path GracefulExitTransferQueue_Path_Field) ( + deleted bool, err error) + Delete_Irreparabledb_By_Segmentpath(ctx context.Context, irreparabledb_segmentpath Irreparabledb_Segmentpath_Field) ( deleted bool, err error) @@ -15828,6 +17168,15 @@ type Methods interface { bucket_usage_id BucketUsage_Id_Field) ( bucket_usage *BucketUsage, err error) + Get_GracefulExitProgress_By_NodeId(ctx context.Context, + graceful_exit_progress_node_id GracefulExitProgress_NodeId_Field) ( + graceful_exit_progress *GracefulExitProgress, err error) + + Get_GracefulExitTransferQueue_By_NodeId_And_Path(ctx context.Context, + graceful_exit_transfer_queue_node_id GracefulExitTransferQueue_NodeId_Field, + graceful_exit_transfer_queue_path GracefulExitTransferQueue_Path_Field) ( + graceful_exit_transfer_queue *GracefulExitTransferQueue, err error) + Get_Irreparabledb_By_Segmentpath(ctx context.Context, irreparabledb_segmentpath Irreparabledb_Segmentpath_Field) ( irreparabledb *Irreparabledb, err error) @@ -15962,6 +17311,17 @@ type Methods interface { update ApiKey_Update_Fields) ( err error) + UpdateNoReturn_GracefulExitProgress_By_NodeId(ctx context.Context, + graceful_exit_progress_node_id GracefulExitProgress_NodeId_Field, + update GracefulExitProgress_Update_Fields) ( + err error) + + UpdateNoReturn_GracefulExitTransferQueue_By_NodeId_And_Path(ctx context.Context, + graceful_exit_transfer_queue_node_id GracefulExitTransferQueue_NodeId_Field, + graceful_exit_transfer_queue_path GracefulExitTransferQueue_Path_Field, + update GracefulExitTransferQueue_Update_Fields) ( + err error) + UpdateNoReturn_Irreparabledb_By_Segmentpath(ctx context.Context, irreparabledb_segmentpath Irreparabledb_Segmentpath_Field, update Irreparabledb_Update_Fields) ( diff --git a/satellite/satellitedb/dbx/satellitedb.dbx.postgres.sql b/satellite/satellitedb/dbx/satellitedb.dbx.postgres.sql index a014b61ec..e1968ca43 100644 --- a/satellite/satellitedb/dbx/satellitedb.dbx.postgres.sql +++ b/satellite/satellitedb/dbx/satellitedb.dbx.postgres.sql @@ -55,6 +55,25 @@ CREATE TABLE bucket_usages ( audit_egress bigint NOT NULL, PRIMARY KEY ( id ) ); +CREATE TABLE graceful_exit_progress ( + node_id bytea NOT NULL, + bytes_transferred bigint NOT NULL, + updated_at timestamp with time zone NOT NULL, + PRIMARY KEY ( node_id ) +); +CREATE TABLE graceful_exit_transfer_queue ( + node_id bytea NOT NULL, + path bytea NOT NULL, + piece_num integer NOT NULL, + durability_ratio double precision NOT NULL, + queued_at timestamp with time zone NOT NULL, + requested_at timestamp with time zone, + last_failed_at timestamp with time zone, + last_failed_code integer, + failed_count integer, + finished_at timestamp with time zone, + PRIMARY KEY ( node_id, path ) +); CREATE TABLE injuredsegments ( path bytea NOT NULL, data bytea NOT NULL, @@ -101,6 +120,9 @@ CREATE TABLE nodes ( audit_reputation_beta double precision NOT NULL, uptime_reputation_alpha double precision NOT NULL, uptime_reputation_beta double precision NOT NULL, + exit_initiated_at timestamp with time zone, + exit_loop_completed_at timestamp with time zone, + exit_finished_at timestamp with time zone, PRIMARY KEY ( id ) ); CREATE TABLE offers ( diff --git a/satellite/satellitedb/dbx/satellitedb.dbx.sqlite3.sql b/satellite/satellitedb/dbx/satellitedb.dbx.sqlite3.sql index c6e6a6343..5da636e13 100644 --- a/satellite/satellitedb/dbx/satellitedb.dbx.sqlite3.sql +++ b/satellite/satellitedb/dbx/satellitedb.dbx.sqlite3.sql @@ -55,6 +55,25 @@ CREATE TABLE bucket_usages ( audit_egress INTEGER NOT NULL, PRIMARY KEY ( id ) ); +CREATE TABLE graceful_exit_progress ( + node_id BLOB NOT NULL, + bytes_transferred INTEGER NOT NULL, + updated_at TIMESTAMP NOT NULL, + PRIMARY KEY ( node_id ) +); +CREATE TABLE graceful_exit_transfer_queue ( + node_id BLOB NOT NULL, + path BLOB NOT NULL, + piece_num INTEGER NOT NULL, + durability_ratio REAL NOT NULL, + queued_at TIMESTAMP NOT NULL, + requested_at TIMESTAMP, + last_failed_at TIMESTAMP, + last_failed_code INTEGER, + failed_count INTEGER, + finished_at TIMESTAMP, + PRIMARY KEY ( node_id, path ) +); CREATE TABLE injuredsegments ( path BLOB NOT NULL, data BLOB NOT NULL, @@ -101,6 +120,9 @@ CREATE TABLE nodes ( audit_reputation_beta REAL NOT NULL, uptime_reputation_alpha REAL NOT NULL, uptime_reputation_beta REAL NOT NULL, + exit_initiated_at TIMESTAMP, + exit_loop_completed_at TIMESTAMP, + exit_finished_at TIMESTAMP, PRIMARY KEY ( id ) ); CREATE TABLE offers ( diff --git a/satellite/satellitedb/migrate.go b/satellite/satellitedb/migrate.go index 5a206f428..fe4c25050 100644 --- a/satellite/satellitedb/migrate.go +++ b/satellite/satellitedb/migrate.go @@ -1206,6 +1206,35 @@ func (db *DB) PostgresMigration() *migrate.Migration { `ALTER TABLE users ALTER COLUMN normalized_email SET NOT NULL;`, }, }, + { + DB: db.db, + Description: "Add Graceful Exit tables and update nodes table", + Version: 56, + Action: migrate.SQL{ + `ALTER TABLE nodes ADD COLUMN exit_loop_completed_at timestamp with time zone;`, + `ALTER TABLE nodes ADD COLUMN exit_initiated_at timestamp with time zone;`, + `ALTER TABLE nodes ADD COLUMN exit_finished_at timestamp with time zone;`, + `CREATE TABLE graceful_exit_progress ( + node_id bytea NOT NULL, + bytes_transferred bigint NOT NULL, + updated_at timestamp with time zone NOT NULL, + PRIMARY KEY ( node_id ) + );`, + `CREATE TABLE graceful_exit_transfer_queue ( + node_id bytea NOT NULL, + path bytea NOT NULL, + piece_num integer NOT NULL, + durability_ratio double precision NOT NULL, + queued_at timestamp with time zone NOT NULL, + requested_at timestamp with time zone, + last_failed_at timestamp with time zone, + last_failed_code integer, + failed_count integer, + finished_at timestamp with time zone, + PRIMARY KEY ( node_id, path ) + );`, + }, + }, }, } } diff --git a/satellite/satellitedb/testdata/postgres.v56.sql b/satellite/satellitedb/testdata/postgres.v56.sql new file mode 100644 index 000000000..1d2cf8ddd --- /dev/null +++ b/satellite/satellitedb/testdata/postgres.v56.sql @@ -0,0 +1,407 @@ +-- AUTOGENERATED BY gopkg.in/spacemonkeygo/dbx.v1 +-- DO NOT EDIT +CREATE TABLE accounting_rollups +( + id bigserial NOT NULL, + node_id bytea NOT NULL, + start_time timestamp with time zone NOT NULL, + put_total bigint NOT NULL, + get_total bigint NOT NULL, + get_audit_total bigint NOT NULL, + get_repair_total bigint NOT NULL, + put_repair_total bigint NOT NULL, + at_rest_total double precision NOT NULL, + PRIMARY KEY (id) +); +CREATE TABLE accounting_timestamps +( + name text NOT NULL, + value timestamp with time zone NOT NULL, + PRIMARY KEY (name) +); +CREATE TABLE bucket_bandwidth_rollups +( + bucket_name bytea NOT NULL, + project_id bytea NOT NULL, + interval_start timestamp NOT NULL, + interval_seconds integer NOT NULL, + action integer NOT NULL, + inline bigint NOT NULL, + allocated bigint NOT NULL, + settled bigint NOT NULL, + PRIMARY KEY (bucket_name, project_id, interval_start, action) +); +CREATE TABLE bucket_storage_tallies +( + bucket_name bytea NOT NULL, + project_id bytea NOT NULL, + interval_start timestamp NOT NULL, + inline bigint NOT NULL, + remote bigint NOT NULL, + remote_segments_count integer NOT NULL, + inline_segments_count integer NOT NULL, + object_count integer NOT NULL, + metadata_size bigint NOT NULL, + PRIMARY KEY (bucket_name, project_id, interval_start) +); +CREATE TABLE bucket_usages +( + id bytea NOT NULL, + bucket_id bytea NOT NULL, + rollup_end_time timestamp with time zone NOT NULL, + remote_stored_data bigint NOT NULL, + inline_stored_data bigint NOT NULL, + remote_segments integer NOT NULL, + inline_segments integer NOT NULL, + objects integer NOT NULL, + metadata_size bigint NOT NULL, + repair_egress bigint NOT NULL, + get_egress bigint NOT NULL, + audit_egress bigint NOT NULL, + PRIMARY KEY (id) +); +CREATE TABLE injuredsegments +( + path bytea NOT NULL, + data bytea NOT NULL, + attempted timestamp, + PRIMARY KEY (path) +); +CREATE TABLE irreparabledbs +( + segmentpath bytea NOT NULL, + segmentdetail bytea NOT NULL, + pieces_lost_count bigint NOT NULL, + seg_damaged_unix_sec bigint NOT NULL, + repair_attempt_count bigint NOT NULL, + PRIMARY KEY (segmentpath) +); +CREATE TABLE nodes +( + id bytea NOT NULL, + address text NOT NULL, + last_net text NOT NULL, + protocol integer NOT NULL, + type integer NOT NULL, + email text NOT NULL, + wallet text NOT NULL, + free_bandwidth bigint NOT NULL, + free_disk bigint NOT NULL, + piece_count bigint NOT NULL, + major bigint NOT NULL, + minor bigint NOT NULL, + patch bigint NOT NULL, + hash text NOT NULL, + timestamp timestamp with time zone NOT NULL, + release boolean NOT NULL, + latency_90 bigint NOT NULL, + audit_success_count bigint NOT NULL, + total_audit_count bigint NOT NULL, + uptime_success_count bigint NOT NULL, + total_uptime_count bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + last_contact_success timestamp with time zone NOT NULL, + last_contact_failure timestamp with time zone NOT NULL, + contained boolean NOT NULL, + disqualified timestamp with time zone, + audit_reputation_alpha double precision NOT NULL, + audit_reputation_beta double precision NOT NULL, + uptime_reputation_alpha double precision NOT NULL, + uptime_reputation_beta double precision NOT NULL, + exit_initiated_at timestamp with time zone, + exit_loop_completed_at timestamp with time zone, + exit_finished_at timestamp with time zone, + PRIMARY KEY (id) +); +CREATE TABLE offers +( + id serial NOT NULL, + name text NOT NULL, + description text NOT NULL, + award_credit_in_cents integer NOT NULL, + invitee_credit_in_cents integer NOT NULL, + award_credit_duration_days integer, + invitee_credit_duration_days integer, + redeemable_cap integer, + expires_at timestamp with time zone NOT NULL, + created_at timestamp with time zone NOT NULL, + status integer NOT NULL, + type integer NOT NULL, + PRIMARY KEY (id) +); +CREATE TABLE peer_identities +( + node_id bytea NOT NULL, + leaf_serial_number bytea NOT NULL, + chain bytea NOT NULL, + updated_at timestamp with time zone NOT NULL, + PRIMARY KEY (node_id) +); +CREATE TABLE pending_audits +( + node_id bytea NOT NULL, + piece_id bytea NOT NULL, + stripe_index bigint NOT NULL, + share_size bigint NOT NULL, + expected_share_hash bytea NOT NULL, + reverify_count bigint NOT NULL, + path bytea NOT NULL, + PRIMARY KEY (node_id) +); +CREATE TABLE projects +( + id bytea NOT NULL, + name text NOT NULL, + description text NOT NULL, + usage_limit bigint NOT NULL, + partner_id bytea, + owner_id bytea NOT NULL, + created_at timestamp with time zone NOT NULL, + PRIMARY KEY (id) +); +CREATE TABLE registration_tokens +( + secret bytea NOT NULL, + owner_id bytea, + project_limit integer NOT NULL, + created_at timestamp with time zone NOT NULL, + PRIMARY KEY (secret), + UNIQUE (owner_id) +); +CREATE TABLE reset_password_tokens +( + secret bytea NOT NULL, + owner_id bytea NOT NULL, + created_at timestamp with time zone NOT NULL, + PRIMARY KEY (secret), + UNIQUE (owner_id) +); +CREATE TABLE serial_numbers +( + id serial NOT NULL, + serial_number bytea NOT NULL, + bucket_id bytea NOT NULL, + expires_at timestamp NOT NULL, + PRIMARY KEY (id) +); +CREATE TABLE storagenode_bandwidth_rollups +( + storagenode_id bytea NOT NULL, + interval_start timestamp NOT NULL, + interval_seconds integer NOT NULL, + action integer NOT NULL, + allocated bigint NOT NULL, + settled bigint NOT NULL, + PRIMARY KEY (storagenode_id, interval_start, action) +); +CREATE TABLE storagenode_storage_tallies +( + id bigserial NOT NULL, + node_id bytea NOT NULL, + interval_end_time timestamp with time zone NOT NULL, + data_total double precision NOT NULL, + PRIMARY KEY (id) +); +CREATE TABLE users ( + id bytea NOT NULL, + email text NOT NULL, + normalized_email text NOT NULL, + full_name text NOT NULL, + short_name text, + password_hash bytea NOT NULL, + status integer NOT NULL, + partner_id bytea, + created_at timestamp with time zone NOT NULL, + PRIMARY KEY ( id ) +); +CREATE TABLE value_attributions +( + project_id bytea NOT NULL, + bucket_name bytea NOT NULL, + partner_id bytea NOT NULL, + last_updated timestamp NOT NULL, + PRIMARY KEY (project_id, bucket_name) +); +CREATE TABLE api_keys +( + id bytea NOT NULL, + project_id bytea NOT NULL REFERENCES projects (id) ON DELETE CASCADE, + head bytea NOT NULL, + name text NOT NULL, + secret bytea NOT NULL, + partner_id bytea, + created_at timestamp with time zone NOT NULL, + PRIMARY KEY (id), + UNIQUE (head), + UNIQUE (name, project_id) +); +CREATE TABLE bucket_metainfos +( + id bytea NOT NULL, + project_id bytea NOT NULL REFERENCES projects (id), + name bytea NOT NULL, + partner_id bytea, + path_cipher integer NOT NULL, + created_at timestamp with time zone NOT NULL, + default_segment_size integer NOT NULL, + default_encryption_cipher_suite integer NOT NULL, + default_encryption_block_size integer NOT NULL, + default_redundancy_algorithm integer NOT NULL, + default_redundancy_share_size integer NOT NULL, + default_redundancy_required_shares integer NOT NULL, + default_redundancy_repair_shares integer NOT NULL, + default_redundancy_optimal_shares integer NOT NULL, + default_redundancy_total_shares integer NOT NULL, + PRIMARY KEY (id), + UNIQUE (name, project_id) +); +CREATE TABLE project_invoice_stamps +( + project_id bytea NOT NULL REFERENCES projects (id) ON DELETE CASCADE, + invoice_id bytea NOT NULL, + start_date timestamp with time zone NOT NULL, + end_date timestamp with time zone NOT NULL, + created_at timestamp with time zone NOT NULL, + PRIMARY KEY (project_id, start_date, end_date), + UNIQUE (invoice_id) +); +CREATE TABLE project_members +( + member_id bytea NOT NULL REFERENCES users (id) ON DELETE CASCADE, + project_id bytea NOT NULL REFERENCES projects (id) ON DELETE CASCADE, + created_at timestamp with time zone NOT NULL, + PRIMARY KEY (member_id, project_id) +); +CREATE TABLE used_serials +( + serial_number_id integer NOT NULL REFERENCES serial_numbers (id) ON DELETE CASCADE, + storage_node_id bytea NOT NULL, + PRIMARY KEY (serial_number_id, storage_node_id) +); +CREATE TABLE user_credits +( + id serial NOT NULL, + user_id bytea NOT NULL REFERENCES users (id) ON DELETE CASCADE, + offer_id integer NOT NULL REFERENCES offers (id), + referred_by bytea REFERENCES users (id) ON DELETE SET NULL, + type text NOT NULL, + credits_earned_in_cents integer NOT NULL, + credits_used_in_cents integer NOT NULL, + expires_at timestamp with time zone NOT NULL, + created_at timestamp with time zone NOT NULL, + PRIMARY KEY (id) +); +CREATE TABLE user_payments +( + user_id bytea NOT NULL REFERENCES users (id) ON DELETE CASCADE, + customer_id bytea NOT NULL, + created_at timestamp with time zone NOT NULL, + PRIMARY KEY (user_id), + UNIQUE (customer_id) +); +CREATE TABLE project_payments +( + id bytea NOT NULL, + project_id bytea NOT NULL REFERENCES projects (id) ON DELETE CASCADE, + payer_id bytea NOT NULL REFERENCES user_payments (user_id) ON DELETE CASCADE, + payment_method_id bytea NOT NULL, + is_default boolean NOT NULL, + created_at timestamp with time zone NOT NULL, + PRIMARY KEY (id) +); +CREATE TABLE graceful_exit_progress ( + node_id bytea NOT NULL, + bytes_transferred bigint NOT NULL, + updated_at timestamp with time zone NOT NULL, + PRIMARY KEY ( node_id ) +); +CREATE TABLE graceful_exit_transfer_queue ( + node_id bytea NOT NULL, + path bytea NOT NULL, + piece_num integer NOT NULL, + durability_ratio double precision NOT NULL, + queued_at timestamp with time zone NOT NULL, + requested_at timestamp with time zone, + last_failed_at timestamp with time zone, + last_failed_code integer, + failed_count integer, + finished_at timestamp with time zone, + PRIMARY KEY ( node_id, path ) +); +CREATE INDEX bucket_name_project_id_interval_start_interval_seconds ON bucket_bandwidth_rollups ( bucket_name, project_id, interval_start, interval_seconds ); +CREATE UNIQUE INDEX bucket_id_rollup ON bucket_usages ( bucket_id, rollup_end_time ); +CREATE INDEX node_last_ip ON nodes ( last_net ); +CREATE UNIQUE INDEX serial_number ON serial_numbers ( serial_number ); +CREATE INDEX serial_numbers_expires_at_index ON serial_numbers ( expires_at ); +CREATE INDEX storagenode_id_interval_start_interval_seconds ON storagenode_bandwidth_rollups ( storagenode_id, interval_start, interval_seconds ); + +CREATE UNIQUE INDEX credits_earned_user_id_offer_id ON user_credits (id, offer_id) WHERE credits_earned_in_cents=0; + +INSERT INTO "accounting_rollups"("id", "node_id", "start_time", "put_total", "get_total", "get_audit_total", "get_repair_total", "put_repair_total", "at_rest_total") VALUES (1, E'\\367M\\177\\251]t/\\022\\256\\214\\265\\025\\224\\204:\\217\\212\\0102<\\321\\374\\020&\\271Qc\\325\\261\\354\\246\\233'::bytea, '2019-02-09 00:00:00+00', 1000, 2000, 3000, 4000, 0, 5000); + +INSERT INTO "accounting_timestamps" VALUES ('LastAtRestTally', '0001-01-01 00:00:00+00'); +INSERT INTO "accounting_timestamps" VALUES ('LastRollup', '0001-01-01 00:00:00+00'); +INSERT INTO "accounting_timestamps" VALUES ('LastBandwidthTally', '0001-01-01 00:00:00+00'); + +INSERT INTO "nodes"("id", "address", "last_net", "protocol", "type", "email", "wallet", "free_bandwidth", "free_disk", "piece_count", "major", "minor", "patch", "hash", "timestamp", "release","latency_90", "audit_success_count", "total_audit_count", "uptime_success_count", "total_uptime_count", "created_at", "updated_at", "last_contact_success", "last_contact_failure", "contained", "disqualified", "audit_reputation_alpha", "audit_reputation_beta", "uptime_reputation_alpha", "uptime_reputation_beta") VALUES (E'\\153\\313\\233\\074\\327\\177\\136\\070\\346\\001', '127.0.0.1:55516', '', 0, 4, '', '', -1, -1, 0, 0, 1, 0, '', 'epoch', false, 0, 0, 5, 0, 5, '2019-02-14 08:07:31.028103+00', '2019-02-14 08:07:31.108963+00', 'epoch', 'epoch', false, NULL, 50, 5, 100, 5); +INSERT INTO "nodes"("id", "address", "last_net", "protocol", "type", "email", "wallet", "free_bandwidth", "free_disk", "piece_count", "major", "minor", "patch", "hash", "timestamp", "release","latency_90", "audit_success_count", "total_audit_count", "uptime_success_count", "total_uptime_count", "created_at", "updated_at", "last_contact_success", "last_contact_failure", "contained", "disqualified", "audit_reputation_alpha", "audit_reputation_beta", "uptime_reputation_alpha", "uptime_reputation_beta") VALUES (E'\\006\\223\\250R\\221\\005\\365\\377v>0\\266\\365\\216\\255?\\347\\244\\371?2\\264\\262\\230\\007<\\001\\262\\263\\237\\247n', '127.0.0.1:55518', '', 0, 4, '', '', -1, -1, 0, 0, 1, 0, '', 'epoch', false, 0, 0, 0, 3, 3, '2019-02-14 08:07:31.028103+00', '2019-02-14 08:07:31.108963+00', 'epoch', 'epoch', false, NULL, 50, 0, 100, 0); +INSERT INTO "nodes"("id", "address", "last_net", "protocol", "type", "email", "wallet", "free_bandwidth", "free_disk", "piece_count", "major", "minor", "patch", "hash", "timestamp", "release","latency_90", "audit_success_count", "total_audit_count", "uptime_success_count", "total_uptime_count", "created_at", "updated_at", "last_contact_success", "last_contact_failure", "contained", "disqualified", "audit_reputation_alpha", "audit_reputation_beta", "uptime_reputation_alpha", "uptime_reputation_beta") VALUES (E'\\363\\342\\363\\371>+F\\256\\263\\300\\273|\\342N\\347\\014', '127.0.0.1:55517', '', 0, 4, '', '', -1, -1, 0, 0, 1, 0, '', 'epoch', false, 0, 0, 0, 0, 0, '2019-02-14 08:07:31.028103+00', '2019-02-14 08:07:31.108963+00', 'epoch', 'epoch', false, NULL, 50, 0, 100, 0); +INSERT INTO "nodes"("id", "address", "last_net", "protocol", "type", "email", "wallet", "free_bandwidth", "free_disk", "piece_count", "major", "minor", "patch", "hash", "timestamp", "release","latency_90", "audit_success_count", "total_audit_count", "uptime_success_count", "total_uptime_count", "created_at", "updated_at", "last_contact_success", "last_contact_failure", "contained", "disqualified", "audit_reputation_alpha", "audit_reputation_beta", "uptime_reputation_alpha", "uptime_reputation_beta") VALUES (E'\\363\\342\\363\\371>+F\\256\\263\\300\\273|\\342N\\347\\015', '127.0.0.1:55519', '', 0, 4, '', '', -1, -1, 0, 0, 1, 0, '', 'epoch', false, 0, 1, 2, 1, 2, '2019-02-14 08:07:31.028103+00', '2019-02-14 08:07:31.108963+00', 'epoch', 'epoch', false, NULL, 50, 1, 100, 1); +INSERT INTO "nodes"("id", "address", "last_net", "protocol", "type", "email", "wallet", "free_bandwidth", "free_disk", "piece_count", "major", "minor", "patch", "hash", "timestamp", "release","latency_90", "audit_success_count", "total_audit_count", "uptime_success_count", "total_uptime_count", "created_at", "updated_at", "last_contact_success", "last_contact_failure", "contained", "disqualified", "audit_reputation_alpha", "audit_reputation_beta", "uptime_reputation_alpha", "uptime_reputation_beta") VALUES (E'\\363\\342\\363\\371>+F\\256\\263\\300\\273|\\342N\\347\\016', '127.0.0.1:55520', '', 0, 4, '', '', -1, -1, 0, 0, 1, 0, '', 'epoch', false, 0, 300, 400, 300, 400, '2019-02-14 08:07:31.028103+00', '2019-02-14 08:07:31.108963+00', 'epoch', 'epoch', false, NULL, 300, 100, 300, 100); + +INSERT INTO "users"("id", "full_name", "short_name", "email", "normalized_email", "password_hash", "status", "partner_id", "created_at") VALUES (E'\\363\\311\\033w\\222\\303Ci\\265\\343U\\303\\312\\204",'::bytea, 'Noahson', 'William', '1email1@mail.test', '1EMAIL1@MAIL.TEST', E'some_readable_hash'::bytea, 1, NULL, '2019-02-14 08:28:24.614594+00'); +INSERT INTO "projects"("id", "name", "description", "usage_limit", "partner_id", "owner_id", "created_at") VALUES (E'\\022\\217/\\014\\376!K\\023\\276\\031\\311}m\\236\\205\\300'::bytea, 'ProjectName', 'projects description', 0, NULL, E'\\363\\311\\033w\\222\\303Ci\\265\\343U\\303\\312\\204",'::bytea, '2019-02-14 08:28:24.254934+00'); + +INSERT INTO "projects"("id", "name", "description", "usage_limit", "partner_id", "owner_id", "created_at") VALUES (E'\\363\\342\\363\\371>+F\\256\\263\\300\\273|\\342N\\347\\014'::bytea, 'projName1', 'Test project 1', 0, NULL, E'\\363\\311\\033w\\222\\303Ci\\265\\343U\\303\\312\\204",'::bytea, '2019-02-14 08:28:24.636949+00'); +INSERT INTO "project_members"("member_id", "project_id", "created_at") VALUES (E'\\363\\311\\033w\\222\\303Ci\\265\\343U\\303\\312\\204",'::bytea, E'\\363\\342\\363\\371>+F\\256\\263\\300\\273|\\342N\\347\\014'::bytea, '2019-02-14 08:28:24.677953+00'); +INSERT INTO "project_members"("member_id", "project_id", "created_at") VALUES (E'\\363\\311\\033w\\222\\303Ci\\265\\343U\\303\\312\\204",'::bytea, E'\\022\\217/\\014\\376!K\\023\\276\\031\\311}m\\236\\205\\300'::bytea, '2019-02-13 08:28:24.677953+00'); + +INSERT INTO "irreparabledbs" ("segmentpath", "segmentdetail", "pieces_lost_count", "seg_damaged_unix_sec", "repair_attempt_count") VALUES ('\x49616d5365676d656e746b6579696e666f30', '\x49616d5365676d656e7464657461696c696e666f30', 10, 1550159554, 10); + +INSERT INTO "injuredsegments" ("path", "data") VALUES ('0', '\x0a0130120100'); +INSERT INTO "injuredsegments" ("path", "data") VALUES ('here''s/a/great/path', '\x0a136865726527732f612f67726561742f70617468120a0102030405060708090a'); +INSERT INTO "injuredsegments" ("path", "data") VALUES ('yet/another/cool/path', '\x0a157965742f616e6f746865722f636f6f6c2f70617468120a0102030405060708090a'); +INSERT INTO "injuredsegments" ("path", "data") VALUES ('so/many/iconic/paths/to/choose/from', '\x0a23736f2f6d616e792f69636f6e69632f70617468732f746f2f63686f6f73652f66726f6d120a0102030405060708090a'); + +INSERT INTO "bucket_usages" ("id", "bucket_id", "rollup_end_time", "remote_stored_data", "inline_stored_data", "remote_segments", "inline_segments", "objects", "metadata_size", "repair_egress", "get_egress", "audit_egress") VALUES (E'\\153\\313\\233\\074\\327\\177\\136\\070\\346\\001",'::bytea, E'\\366\\146\\032\\321\\316\\161\\070\\133\\302\\271",'::bytea, '2019-03-06 08:28:24.677953+00', 10, 11, 12, 13, 14, 15, 16, 17, 18); + +INSERT INTO "registration_tokens" ("secret", "owner_id", "project_limit", "created_at") VALUES (E'\\070\\127\\144\\013\\332\\344\\102\\376\\306\\056\\303\\130\\106\\132\\321\\276\\321\\274\\170\\264\\054\\333\\221\\116\\154\\221\\335\\070\\220\\146\\344\\216'::bytea, null, 1, '2019-02-14 08:28:24.677953+00'); + +INSERT INTO "serial_numbers" ("id", "serial_number", "bucket_id", "expires_at") VALUES (1, E'0123456701234567'::bytea, E'\\363\\342\\363\\371>+F\\256\\263\\300\\273|\\342N\\347\\014/testbucket'::bytea, '2019-03-06 08:28:24.677953+00'); +INSERT INTO "used_serials" ("serial_number_id", "storage_node_id") VALUES (1, E'\\006\\223\\250R\\221\\005\\365\\377v>0\\266\\365\\216\\255?\\347\\244\\371?2\\264\\262\\230\\007<\\001\\262\\263\\237\\247n'); + +INSERT INTO "storagenode_bandwidth_rollups" ("storagenode_id", "interval_start", "interval_seconds", "action", "allocated", "settled") VALUES (E'\\006\\223\\250R\\221\\005\\365\\377v>0\\266\\365\\216\\255?\\347\\244\\371?2\\264\\262\\230\\007<\\001\\262\\263\\237\\247n', '2019-03-06 08:00:00.000000+00', 3600, 1, 1024, 2024); +INSERT INTO "storagenode_storage_tallies" VALUES (1, E'\\3510\\323\\225"~\\036<\\342\\330m\\0253Jhr\\246\\233K\\246#\\2303\\351\\256\\275j\\212UM\\362\\207', '2019-02-14 08:16:57.812849+00', 1000); + +INSERT INTO "bucket_bandwidth_rollups" ("bucket_name", "project_id", "interval_start", "interval_seconds", "action", "inline", "allocated", "settled") VALUES (E'testbucket'::bytea, E'\\363\\342\\363\\371>+F\\256\\263\\300\\273|\\342N\\347\\014'::bytea,'2019-03-06 08:00:00.000000+00', 3600, 1, 1024, 2024, 3024); +INSERT INTO "bucket_storage_tallies" ("bucket_name", "project_id", "interval_start", "inline", "remote", "remote_segments_count", "inline_segments_count", "object_count", "metadata_size") VALUES (E'testbucket'::bytea, E'\\363\\342\\363\\371>+F\\256\\263\\300\\273|\\342N\\347\\014'::bytea,'2019-03-06 08:00:00.000000+00', 4024, 5024, 0, 0, 0, 0); +INSERT INTO "bucket_bandwidth_rollups" ("bucket_name", "project_id", "interval_start", "interval_seconds", "action", "inline", "allocated", "settled") VALUES (E'testbucket'::bytea, E'\\170\\160\\157\\370\\274\\366\\113\\364\\272\\235\\301\\243\\321\\102\\321\\136'::bytea,'2019-03-06 08:00:00.000000+00', 3600, 1, 1024, 2024, 3024); +INSERT INTO "bucket_storage_tallies" ("bucket_name", "project_id", "interval_start", "inline", "remote", "remote_segments_count", "inline_segments_count", "object_count", "metadata_size") VALUES (E'testbucket'::bytea, E'\\170\\160\\157\\370\\274\\366\\113\\364\\272\\235\\301\\243\\321\\102\\321\\136'::bytea,'2019-03-06 08:00:00.000000+00', 4024, 5024, 0, 0, 0, 0); + +INSERT INTO "reset_password_tokens" ("secret", "owner_id", "created_at") VALUES (E'\\070\\127\\144\\013\\332\\344\\102\\376\\306\\056\\303\\130\\106\\132\\321\\276\\321\\274\\170\\264\\054\\333\\221\\116\\154\\221\\335\\070\\220\\146\\344\\216'::bytea, E'\\363\\311\\033w\\222\\303Ci\\265\\343U\\303\\312\\204",'::bytea, '2019-05-08 08:28:24.677953+00'); + +INSERT INTO "offers" ("name", "description", "award_credit_in_cents", "invitee_credit_in_cents", "award_credit_duration_days", "invitee_credit_duration_days", "redeemable_cap", "expires_at", "created_at", "status", "type") VALUES ('testOffer', 'Test offer 1', 0, 0, 14, 14, 50, '2019-03-14 08:28:24.636949+00', '2019-02-14 08:28:24.636949+00', 0, 0); +INSERT INTO "offers" ("name","description","award_credit_in_cents","award_credit_duration_days", "invitee_credit_in_cents","invitee_credit_duration_days", "expires_at","created_at","status","type") VALUES ('Default free credit offer','Is active when no active free credit offer',0, NULL,300, 14, '2119-03-14 08:28:24.636949+00','2019-07-14 08:28:24.636949+00',1,1); + +INSERT INTO "api_keys" ("id", "project_id", "head", "name", "secret", "partner_id", "created_at") VALUES (E'\\334/\\302;\\225\\355O\\323\\276f\\247\\354/6\\241\\033'::bytea, E'\\022\\217/\\014\\376!K\\023\\276\\031\\311}m\\236\\205\\300'::bytea, E'\\111\\142\\147\\304\\132\\375\\070\\163\\270\\160\\251\\370\\126\\063\\351\\037\\257\\071\\143\\375\\351\\320\\253\\232\\220\\260\\075\\173\\306\\307\\115\\136'::bytea, 'key 2', E'\\254\\011\\315\\333\\273\\365\\001\\071\\024\\154\\253\\332\\301\\216\\361\\074\\221\\367\\251\\231\\274\\333\\300\\367\\001\\272\\327\\111\\315\\123\\042\\016'::bytea, NULL, '2019-02-14 08:28:24.267934+00'); + +INSERT INTO "user_payments" ("user_id", "customer_id", "created_at") VALUES (E'\\363\\311\\033w\\222\\303Ci\\265\\343U\\303\\312\\204",'::bytea, E'\\022\\217/\\014\\376!K\\023\\276'::bytea, '2019-06-01 08:28:24.267934+00'); +INSERT INTO "project_invoice_stamps" ("project_id", "invoice_id", "start_date", "end_date", "created_at") VALUES (E'\\022\\217/\\014\\376!K\\023\\276\\031\\311}m\\236\\205\\300'::bytea, E'\\363\\311\\033w\\222\\303,'::bytea, '2019-06-01 08:28:24.267934+00', '2019-06-29 08:28:24.267934+00', '2019-06-01 08:28:24.267934+00'); + +INSERT INTO "value_attributions" ("project_id", "bucket_name", "partner_id", "last_updated") VALUES (E'\\363\\311\\033w\\222\\303Ci\\265\\343U\\303\\312\\204",'::bytea, E''::bytea, E'\\363\\342\\363\\371>+F\\256\\263\\300\\273|\\342N\\347\\014'::bytea,'2019-02-14 08:07:31.028103+00'); + +INSERT INTO "user_credits" ("id", "user_id", "offer_id", "referred_by", "credits_earned_in_cents", "credits_used_in_cents", "type", "expires_at", "created_at") VALUES (1, E'\\363\\311\\033w\\222\\303Ci\\265\\343U\\303\\312\\204",'::bytea, 1, E'\\363\\311\\033w\\222\\303Ci\\265\\343U\\303\\312\\204",'::bytea, 200, 0, 'invalid', '2019-10-01 08:28:24.267934+00', '2019-06-01 08:28:24.267934+00'); + +INSERT INTO "bucket_metainfos" ("id", "project_id", "name", "partner_id", "created_at", "path_cipher", "default_segment_size", "default_encryption_cipher_suite", "default_encryption_block_size", "default_redundancy_algorithm", "default_redundancy_share_size", "default_redundancy_required_shares", "default_redundancy_repair_shares", "default_redundancy_optimal_shares", "default_redundancy_total_shares") VALUES (E'\\334/\\302;\\225\\355O\\323\\276f\\247\\354/6\\241\\033'::bytea, E'\\022\\217/\\014\\376!K\\023\\276\\031\\311}m\\236\\205\\300'::bytea, E'testbucketuniquename'::bytea, NULL, '2019-06-14 08:28:24.677953+00', 1, 65536, 1, 8192, 1, 4096, 4, 6, 8, 10); + +INSERT INTO "project_payments" ("id", "project_id", "payer_id", "payment_method_id", "is_default","created_at") VALUES (E'\\334/\\302;\\225\\355O\\323\\276f\\247\\354/6\\241\\033'::bytea, E'\\363\\342\\363\\371>+F\\256\\263\\300\\273|\\342N\\347\\014'::bytea, E'\\363\\311\\033w\\222\\303Ci\\265\\343U\\303\\312\\204",'::bytea, E'\\022\\217/\\014\\376!K\\023\\276'::bytea, true, '2019-06-01 08:28:24.267934+00'); + +INSERT INTO "pending_audits" ("node_id", "piece_id", "stripe_index", "share_size", "expected_share_hash", "reverify_count", "path") VALUES (E'\\153\\313\\233\\074\\327\\177\\136\\070\\346\\001'::bytea, E'\\363\\311\\033w\\222\\303Ci\\265\\343U\\303\\312\\204",'::bytea, 5, 1024, E'\\070\\127\\144\\013\\332\\344\\102\\376\\306\\056\\303\\130\\106\\132\\321\\276\\321\\274\\170\\264\\054\\333\\221\\116\\154\\221\\335\\070\\220\\146\\344\\216'::bytea, 1, 'not null'); + +INSERT INTO "peer_identities" VALUES (E'\\334/\\302;\\225\\355O\\323\\276f\\247\\354/6\\241\\033'::bytea, E'\\363\\342\\363\\371>+F\\256\\263\\300\\273|\\342N\\347\\014'::bytea, E'\\363\\311\\033w\\222\\303Ci\\265\\343U\\303\\312\\204",'::bytea, '2019-02-14 08:07:31.335028+00'); + +-- NEW DATA -- +INSERT INTO "graceful_exit_progress" ("node_id", "bytes_transferred", "updated_at") VALUES (E'\\363\\342\\363\\371>+F\\256\\263\\300\\273|\\342N\\347\\016', 1000000000000000, '2019-09-12 10:07:31.028103+00'); +INSERT INTO "graceful_exit_transfer_queue" ("node_id", "path", "piece_num", "durability_ratio", "queued_at", "requested_at", "last_failed_at", "last_failed_code", "failed_count", "finished_at") VALUES (E'\\363\\342\\363\\371>+F\\256\\263\\300\\273|\\342N\\347\\016', E'f8419768-5baa-4901-b3ba-62808013ec45/s0/test3/\\240\\243\\223n \\334~b}\\2624)\\250m\\201\\202\\235\\276\\361\\3304\\323\\352\\311\\361\\353;\\326\\311', 8, 1.0, '2019-09-12 10:07:31.028103+00', '2019-09-12 10:07:32.028103+00', null, null, 0, '2019-09-12 10:07:33.028103+00'); +INSERT INTO "graceful_exit_transfer_queue" ("node_id", "path", "piece_num", "durability_ratio", "queued_at", "requested_at", "last_failed_at", "last_failed_code", "failed_count", "finished_at") VALUES (E'\\363\\342\\363\\371>+F\\256\\263\\300\\273|\\342N\\347\\016', E'f8419768-5baa-4901-b3ba-62808013ec45/s0/test3/\\240\\243\\223n \\334~b}\\2624)\\250m\\201\\202\\235\\276\\361\\3304\\323\\352\\311\\361\\353;\\326\\312', 8, 1.0, '2019-09-12 10:07:31.028103+00', '2019-09-12 10:07:32.028103+00', null, null, 0, '2019-09-12 10:07:33.028103+00');