/
satellitedb.dbx
1359 lines (1091 loc) · 32.9 KB
/
satellitedb.dbx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// dbx.v1 golang satellitedb.dbx .
//--- Value Attribution ---//
model value_attribution (
key project_id bucket_name
field project_id blob
field bucket_name blob
field partner_id blob
field last_updated timestamp ( autoinsert, autoupdate )
)
create value_attribution ()
delete value_attribution (
where value_attribution.project_id = ?
where value_attribution.bucket_name = ?
)
read one (
select value_attribution
where value_attribution.project_id = ?
where value_attribution.bucket_name = ?
)
//--- containment ---//
model pending_audits (
key node_id
field node_id blob
field piece_id blob
field stripe_index int64
field share_size int64
field expected_share_hash blob
field reverify_count int64 ( updatable )
field path blob
)
create pending_audits ( )
update pending_audits ( where pending_audits.node_id = ? )
delete pending_audits ( where pending_audits.node_id = ? )
read one (
select pending_audits
where pending_audits.node_id = ?
)
//--- irreparableDB ---//
model irreparabledb (
key segmentpath
field segmentpath blob
field segmentdetail blob ( updatable )
field pieces_lost_count int64 ( updatable )
field seg_damaged_unix_sec int64 ( updatable )
field repair_attempt_count int64 ( updatable )
)
create irreparabledb ( noreturn )
update irreparabledb (
where irreparabledb.segmentpath = ?
noreturn
)
delete irreparabledb ( where irreparabledb.segmentpath = ? )
read one (
select irreparabledb
where irreparabledb.segmentpath = ?
)
read limitoffset (
select irreparabledb
where irreparabledb.segmentpath > ?
orderby asc irreparabledb.segmentpath
)
//--- accounting ---//
// accounting_timestamps just allows us to save the last time/thing that happened
model accounting_timestamps (
key name
field name text
field value timestamp ( updatable )
)
create accounting_timestamps ( noreturn )
update accounting_timestamps (
where accounting_timestamps.name = ?
noreturn
)
read scalar (
select accounting_timestamps.value
where accounting_timestamps.name = ?
)
model accounting_rollup (
key id
index ( fields start_time )
field id serial64
field node_id blob
field start_time timestamp
field put_total int64
field get_total int64
field get_audit_total int64
field get_repair_total int64
field put_repair_total int64
field at_rest_total float64
)
create accounting_rollup ( noreturn )
delete accounting_rollup ( where accounting_rollup.id = ? )
read one (
select accounting_rollup
where accounting_rollup.id = ?
)
read all (
select accounting_rollup
where accounting_rollup.start_time >= ?
)
//--- overlay cache ---//
model node (
key id
index (
name node_last_ip
fields last_net
)
field id blob
// address is how to contact the node, this can be a hostname or IP and it contains the port
field address text ( updatable, default "" ) // TODO: use compressed format
// last_net is the /24 subnet of the IP
field last_net text ( updatable )
field last_ip_port text ( updatable, nullable )
field protocol int ( updatable, default 0 )
field type int ( updatable, default 0 )
field email text ( updatable )
field wallet text ( updatable ) // TODO: use compressed format
field free_disk int64 ( updatable, default -1 )
field piece_count int64 ( autoinsert, updatable, default 0 )
field major int64 ( updatable, default 0 )
field minor int64 ( updatable, default 0 )
field patch int64 ( updatable, default 0 )
field hash text ( updatable, default "" )
field timestamp timestamp ( updatable, default "0001-01-01 00:00:00+00" )
field release bool ( updatable, default false )
field latency_90 int64 ( updatable, default 0 )
field audit_success_count int64 ( updatable, default 0 )
field total_audit_count int64 ( updatable, default 0 )
field vetted_at timestamp ( updatable, nullable )
field uptime_success_count int64 ( updatable )
field total_uptime_count int64 ( updatable )
field created_at timestamp ( autoinsert, default current_timestamp )
field updated_at timestamp ( autoinsert, autoupdate, default current_timestamp )
field last_contact_success timestamp ( updatable, default "epoch" )
field last_contact_failure timestamp ( updatable, default "epoch" )
field contained bool ( updatable, default false )
// node is disqualified when it fails too many audits or is offline for too long
field disqualified timestamp ( updatable, nullable )
// node is placed under inspection when it has too many unknown-error audits
field suspended timestamp ( updatable, nullable )
// renamed column from suspended
field unknown_audit_suspended timestamp ( updatable, nullable )
// node is considered unhealthy if it is offline for too many audits
field offline_suspended timestamp ( updatable, nullable )
// once a node becomes offline_suspended, mark it as under review so we check it again later
field under_review timestamp ( updatable, nullable )
// audit_reputation_fields track information related to successful vs. failed error audits
field audit_reputation_alpha float64 ( updatable, default 1 )
field audit_reputation_beta float64 ( updatable, default 0 )
// unknown_audit_reputation fields track information related to successful vs. unknown error audits
field unknown_audit_reputation_alpha float64 ( updatable, default 1 )
field unknown_audit_reputation_beta float64 ( updatable, default 0 )
// TODO remove uptime alpha/beta once old uptime dq code is removed
field uptime_reputation_alpha float64 ( updatable, default 1 )
field uptime_reputation_beta float64 ( updatable, default 0 )
field exit_initiated_at timestamp ( updatable, nullable )
field exit_loop_completed_at timestamp ( updatable, nullable )
field exit_finished_at timestamp ( updatable, nullable )
field exit_success bool ( updatable, default false )
)
create node ( noreturn )
update node ( where node.id = ? )
update node (
where node.id = ?
noreturn
)
delete node ( where node.id = ? )
// "Get" query; fails if node not found
read one (
select node
where node.id = ?
)
read all (
select node.id
)
read limitoffset (
select node
where node.id >= ?
orderby asc node.id
)
read all (
select node.id node.piece_count
where node.piece_count != 0
)
read limitoffset (
select node.id node.address node.last_ip_port node.last_contact_success node.last_contact_failure
where node.last_contact_success < node.last_contact_failure
where node.disqualified = null
orderby asc node.last_contact_failure
)
read all (
select node.id node.address node.last_ip_port node.last_contact_success node.last_contact_failure
where node.last_contact_success < ?
where node.last_contact_success > node.last_contact_failure
where node.disqualified = null
orderby asc node.last_contact_success
)
//--- audit history ---//
model audit_history (
key node_id
field node_id blob
field history blob ( updatable )
)
create audit_history ()
update audit_history ( where audit_history.node_id = ? )
read one (
select audit_history
where audit_history.node_id = ?
)
//--- repairqueue ---//
model injuredsegment (
key path
field path blob
field data blob
field attempted timestamp (updatable, nullable)
field num_healthy_pieces int (default 52)
index (
fields attempted
)
index (
fields num_healthy_pieces
)
)
//--- satellite console ---//
model user (
key id
field id blob
field email text ( updatable )
field normalized_email text ( updatable )
field full_name text ( updatable )
field short_name text ( updatable, nullable )
field password_hash blob ( updatable )
field status int ( updatable, autoinsert )
field partner_id blob ( nullable )
field created_at timestamp ( autoinsert )
)
create user ( )
update user ( where user.id = ? )
delete user ( where user.id = ? )
read one (
select user
where user.normalized_email = ?
where user.status != 0
)
read one (
select user
where user.id = ?
)
model project (
key id
field id blob
field name text ( updatable )
field description text ( updatable )
field usage_limit int64 ( updatable, default 0 )
field bandwidth_limit int64 ( updatable, default 0 )
field rate_limit int ( nullable, updatable )
field partner_id blob ( nullable )
field owner_id blob
field created_at timestamp ( autoinsert )
)
create project ( )
update project ( where project.id = ? )
delete project ( where project.id = ? )
read one (
select project
where project.id = ?
)
read one (
select project.usage_limit
where project.id = ?
)
read one (
select project.bandwidth_limit
where project.id = ?
)
read all (
select project
)
read all (
select project
where project.created_at < ?
orderby asc project.created_at
)
read all (
select project
where project.owner_id = ?
orderby asc project.created_at
)
read all (
select project
join project.id = project_member.project_id
where project_member.member_id = ?
orderby asc project.name
)
read limitoffset (
select project
where project.created_at < ?
orderby asc project.created_at
)
model project_invoice_stamp (
key project_id start_date end_date
unique invoice_id
field project_id project.id cascade
field invoice_id blob
field start_date timestamp
field end_date timestamp
field created_at timestamp
)
create project_invoice_stamp ( )
read one (
select project_invoice_stamp
where project_invoice_stamp.project_id = ?
where project_invoice_stamp.start_date = ?
)
// pagination ?
read all (
select project_invoice_stamp
where project_invoice_stamp.project_id = ?
orderby desc project_invoice_stamp.start_date
)
model project_member (
key member_id project_id
field member_id user.id cascade
field project_id project.id cascade
field created_at timestamp ( autoinsert )
)
create project_member ( )
delete project_member (
where project_member.member_id = ?
where project_member.project_id = ?
)
read all (
select project_member
where project_member.member_id = ?
)
read limitoffset (
select project_member
where project_member.project_id = ?
)
model api_key (
key id
unique head
unique name project_id
field id blob
field project_id project.id cascade
field head blob
field name text (updatable)
field secret blob
field partner_id blob (nullable)
field created_at timestamp (autoinsert)
)
create api_key ( )
update api_key (
where api_key.id = ?
noreturn
)
delete api_key ( where api_key.id = ? )
read one (
select api_key
where api_key.id = ?
)
read one (
select api_key
where api_key.head = ?
)
read one (
select api_key
where api_key.name = ?
where api_key.project_id = ?
)
read all (
select api_key
where api_key.project_id = ?
orderby asc api_key.name
)
//--- tracking serial numbers ---//
model serial_number (
key id
index (
name serial_number_index
fields serial_number
unique
)
field id serial
field serial_number blob
field bucket_id blob
field expires_at timestamp
index (
fields expires_at
)
)
read one (
select serial_number.bucket_id
where serial_number.serial_number = ?
)
model used_serial (
key serial_number_id storage_node_id
field serial_number_id serial_number.id cascade
field storage_node_id blob
)
// inserting a new serial number
create serial_number ( noreturn )
// finding out information about the serial number
read scalar (
select serial_number
where serial_number.serial_number = ?
)
// deleting expired serial numbers
delete serial_number (
where serial_number.expires_at <= ?
)
// for preventing duplicate serial numbers
create used_serial ( noreturn )
//
// DEPRECATED! vvvvvvvvvvvvvvvvvvvvvvvvvvv
//
model reported_serial (
key expires_at storage_node_id bucket_id action serial_number
field expires_at timestamp // ceil'd to the next day
field storage_node_id blob // involved node id
field bucket_id blob // involved project id and bucket name
field action uint // action (get, put, audit, etc. see protobuf)
field serial_number blob // identifies order (required for uniqueness)
field settled uint64
field observed_at timestamp
)
//
// DEPRECATED! ^^^^^^^^^^^^^^^^^^^^^^^^^^
//
model pending_serial_queue (
table pending_serial_queue
key storage_node_id bucket_id serial_number
field storage_node_id blob
field bucket_id blob
field serial_number blob
field action uint
field settled uint64
field expires_at timestamp
)
create pending_serial_queue ( noreturn, replace )
read paged ( select pending_serial_queue )
model consumed_serial (
key storage_node_id serial_number
index ( fields expires_at )
field storage_node_id blob
field serial_number blob
field expires_at timestamp
)
create consumed_serial ( noreturn )
delete consumed_serial ( where consumed_serial.expires_at <= ? )
read has (
select consumed_serial
where consumed_serial.storage_node_id = ?
where consumed_serial.serial_number = ?
)
// --- bucket accounting tables --- //
model bucket_bandwidth_rollup (
key bucket_name project_id interval_start action
index (
name bucket_bandwidth_rollups_project_id_action_interval_index
fields project_id action interval_start
)
index (
name bucket_bandwidth_rollups_action_interval_project_id_index
fields action interval_start project_id
)
field bucket_name blob
field project_id blob
field interval_start timestamp
field interval_seconds uint
field action uint
field inline uint64 ( updatable )
field allocated uint64 ( updatable )
field settled uint64 ( updatable )
)
read scalar (
select bucket_bandwidth_rollup
where bucket_bandwidth_rollup.bucket_name = ?
where bucket_bandwidth_rollup.project_id = ?
where bucket_bandwidth_rollup.interval_start = ?
where bucket_bandwidth_rollup.action = ?
)
model revocation (
key revoked
field revoked blob
field api_key_id blob
)
create revocation ( noreturn )
model project_bandwidth_rollup (
key project_id interval_month
field project_id blob
field interval_month date
field egress_allocated uint64 ( updatable )
)
read scalar (
select project_bandwidth_rollup
where project_bandwidth_rollup.project_id = ?
where project_bandwidth_rollup.interval_month = ?
)
model bucket_storage_tally (
key bucket_name project_id interval_start
field bucket_name blob
field project_id blob
field interval_start timestamp
field inline uint64
field remote uint64
field remote_segments_count uint
field inline_segments_count uint
field object_count uint
field metadata_size uint64
)
create bucket_storage_tally ( noreturn )
read first (
select bucket_storage_tally
where bucket_storage_tally.project_id = ?
orderby desc bucket_storage_tally.interval_start
)
read all (
select bucket_storage_tally
)
read all (
select bucket_storage_tally
where bucket_storage_tally.project_id = ?
where bucket_storage_tally.bucket_name = ?
where bucket_storage_tally.interval_start >= ?
where bucket_storage_tally.interval_start <= ?
orderby desc bucket_storage_tally.interval_start
)
// --- storage node accounting tables --- //
model storagenode_bandwidth_rollup (
key storagenode_id interval_start action
field storagenode_id blob
field interval_start timestamp
field interval_seconds uint
field action uint
field allocated uint64 ( updatable, nullable, default 0 )
field settled uint64 ( updatable )
)
create storagenode_bandwidth_rollup()
read scalar (
select storagenode_bandwidth_rollup
where storagenode_bandwidth_rollup.storagenode_id = ?
where storagenode_bandwidth_rollup.interval_start = ?
where storagenode_bandwidth_rollup.action = ?
)
read all (
select storagenode_bandwidth_rollup
where storagenode_bandwidth_rollup.interval_start >= ?
)
read all (
select storagenode_bandwidth_rollup
where storagenode_bandwidth_rollup.storagenode_id = ?
where storagenode_bandwidth_rollup.interval_start = ?
)
model storagenode_storage_tally (
// this primary key will enforce uniqueness on interval_end_time,node_id
// and also creates an index on interval_end_time implicitly.
// the interval_end_time will be the same value for many rows so
// we put that first so we can use cockroachdb prefix compression.
// node_id is also used many times but interval_end_time is more
// repetative and will benefit greater.
key interval_end_time node_id
index ( fields node_id )
field node_id blob
field interval_end_time timestamp
field data_total float64
)
read all (
select storagenode_storage_tally
)
read all (
select storagenode_storage_tally
where storagenode_storage_tally.interval_end_time >= ?
)
// --- storage node payment tables --- //
model storagenode_paystub (
// The (period, node_id) tuple is the primary key. The primary key index
// should serve for quick queries for all paystubs in a given period since
// it comes first but efficient queries for all paystubs with a given
// node_id will require a distinct index.
key period node_id
index ( fields node_id )
field period text // YYYY-MM, e.g. 2020-02
field node_id blob //
field created_at timestamp ( autoinsert ) //
field codes text // colon separated list
field usage_at_rest float64 // byte-hours of data at rest
field usage_get int64 // bytes of bandwidth
field usage_put int64 // bytes of bandwidth
field usage_get_repair int64 // bytes of bandwidth
field usage_put_repair int64 // bytes of bandwidth
field usage_get_audit int64 // bytes of bandwidth
field comp_at_rest int64 // in micro-units of currency
field comp_get int64 // in micro-units of currency
field comp_put int64 // in micro-units of currency
field comp_get_repair int64 // in micro-units of currency
field comp_put_repair int64 // in micro-units of currency
field comp_get_audit int64 // in micro-units of currency
field surge_percent int64 // percentage
field held int64 // in micro-units of currency
field owed int64 // in micro-units of currency
field disposed int64 // in micro-units of currency
field paid int64 // in micro-units of currency
)
create storagenode_paystub ( noreturn )
model storagenode_payment (
key id
index ( fields node_id period )
field id serial64 //
field created_at timestamp ( autoinsert ) //
field node_id blob //
field period text // YYYY-MM, e.g. 2020-02
field amount int64 // in micro-units of currency
field receipt text ( nullable ) //
field notes text ( nullable ) //
)
create storagenode_payment ( noreturn )
//--- peer_identity ---//
model peer_identity (
key node_id
field node_id blob
field leaf_serial_number blob (updatable)
field chain blob (updatable) // x509 ASN.1 DER content
field updated_at timestamp ( autoinsert, autoupdate )
)
create peer_identity ( noreturn )
update peer_identity (
where peer_identity.node_id = ?
noreturn
)
read one (
select peer_identity
where peer_identity.node_id = ?
)
read one (
select peer_identity.leaf_serial_number
where peer_identity.node_id = ?
)
//--- satellite registration token for Vanguard release (temporary table) ---//
model registration_token (
key secret
unique owner_id
field secret blob
field owner_id blob ( updatable, nullable )
field project_limit int
field created_at timestamp ( autoinsert )
)
create registration_token ( )
read one (
select registration_token
where registration_token.secret = ?
)
read one (
select registration_token
where registration_token.owner_id = ?
)
update registration_token ( where registration_token.secret = ? )
//--- satellite reset password token ---//
model reset_password_token (
key secret
unique owner_id
field secret blob
field owner_id blob ( updatable )
field created_at timestamp ( autoinsert )
)
create reset_password_token ( )
read one (
select reset_password_token
where reset_password_token.secret = ?
)
read one (
select reset_password_token
where reset_password_token.owner_id = ?
)
delete reset_password_token ( where reset_password_token.secret = ? )
//--- offer table ---//
model offer (
key id
field id serial
field name text ( updatable )
field description text ( updatable )
field award_credit_in_cents int ( updatable, default 0 )
field invitee_credit_in_cents int ( updatable, default 0 )
field award_credit_duration_days int ( updatable, nullable )
field invitee_credit_duration_days int ( updatable, nullable )
field redeemable_cap int ( updatable, nullable )
field expires_at timestamp ( updatable )
field created_at timestamp ( autoinsert )
// status corresponds to the values of rewards.OfferStatus
field status int ( updatable )
// type corresponds to the values of rewards.OfferType
field type int ( updatable )
)
read one (
select offer
where offer.id = ?
)
read all (
select offer
orderby asc offer.id
)
update offer (
where offer.id = ?
noreturn
)
create offer ( )
//--- user credit table ---//
model user_credit (
key id
unique id offer_id
index (
name credits_earned_user_id_offer_id
fields id offer_id
unique
)
field id serial
field user_id user.id cascade
field offer_id offer.id restrict
field referred_by user.id setnull ( nullable )
field type text
field credits_earned_in_cents int
field credits_used_in_cents int ( updatable, autoinsert )
field expires_at timestamp ( updatable )
field created_at timestamp ( autoinsert )
)
read all (
select user_credit
where user_credit.user_id = ?
where user_credit.expires_at > ?
where user_credit.credits_used_in_cents < user_credit.credits_earned_in_cents
orderby asc user_credit.expires_at
)
read count (
select user_credit
where user_credit.referred_by = ?
)
create user_credit ()
//--- metainfo buckets ---//
model bucket_metainfo (
key id
unique name project_id
field id blob
field project_id project.id restrict
field name blob
field partner_id blob (nullable, updatable)
field path_cipher int
field created_at timestamp ( autoinsert )
field default_segment_size int (updatable)
field default_encryption_cipher_suite int (updatable)
field default_encryption_block_size int (updatable)
field default_redundancy_algorithm int (updatable)
field default_redundancy_share_size int (updatable)
field default_redundancy_required_shares int (updatable)
field default_redundancy_repair_shares int (updatable)
field default_redundancy_optimal_shares int (updatable)
field default_redundancy_total_shares int (updatable)
)
create bucket_metainfo ()
update bucket_metainfo (
where bucket_metainfo.project_id = ?
where bucket_metainfo.name = ?
)
read one (
select bucket_metainfo
where bucket_metainfo.project_id = ?
where bucket_metainfo.name = ?
)
delete bucket_metainfo (
where bucket_metainfo.project_id = ?
where bucket_metainfo.name = ?
)
read limitoffset ( // Forward
select bucket_metainfo
where bucket_metainfo.project_id = ?
where bucket_metainfo.name >= ?
orderby asc bucket_metainfo.name
)
read limitoffset ( // After
select bucket_metainfo
where bucket_metainfo.project_id = ?
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 pieces_transferred int64 ( autoinsert, updatable, default 0 )
field pieces_failed int64 ( autoinsert, updatable, default 0 )
field updated_at timestamp ( autoinsert, autoupdate )
)
create graceful_exit_progress ( noreturn )
update graceful_exit_progress (
where graceful_exit_progress.node_id = ?