-
Notifications
You must be signed in to change notification settings - Fork 33
/
nodes.capnp.go
1130 lines (921 loc) · 28.9 KB
/
nodes.capnp.go
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
// Code generated by capnpc-go. DO NOT EDIT.
package capnp
import (
strconv "strconv"
capnp "zombiezen.com/go/capnproto2"
text "zombiezen.com/go/capnproto2/encoding/text"
schemas "zombiezen.com/go/capnproto2/schemas"
)
// Commit is a set of changes to nodes
type Commit struct{ capnp.Struct }
type Commit_merge Commit
// Commit_TypeID is the unique identifier for the type Commit.
const Commit_TypeID = 0x8da013c66e545daf
func NewCommit(s *capnp.Segment) (Commit, error) {
st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 6})
return Commit{st}, err
}
func NewRootCommit(s *capnp.Segment) (Commit, error) {
st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 6})
return Commit{st}, err
}
func ReadRootCommit(msg *capnp.Message) (Commit, error) {
root, err := msg.RootPtr()
return Commit{root.Struct()}, err
}
func (s Commit) String() string {
str, _ := text.Marshal(0x8da013c66e545daf, s.Struct)
return str
}
func (s Commit) Message() (string, error) {
p, err := s.Struct.Ptr(0)
return p.Text(), err
}
func (s Commit) HasMessage() bool {
p, err := s.Struct.Ptr(0)
return p.IsValid() || err != nil
}
func (s Commit) MessageBytes() ([]byte, error) {
p, err := s.Struct.Ptr(0)
return p.TextBytes(), err
}
func (s Commit) SetMessage(v string) error {
return s.Struct.SetText(0, v)
}
func (s Commit) Author() (string, error) {
p, err := s.Struct.Ptr(1)
return p.Text(), err
}
func (s Commit) HasAuthor() bool {
p, err := s.Struct.Ptr(1)
return p.IsValid() || err != nil
}
func (s Commit) AuthorBytes() ([]byte, error) {
p, err := s.Struct.Ptr(1)
return p.TextBytes(), err
}
func (s Commit) SetAuthor(v string) error {
return s.Struct.SetText(1, v)
}
func (s Commit) Parent() ([]byte, error) {
p, err := s.Struct.Ptr(2)
return []byte(p.Data()), err
}
func (s Commit) HasParent() bool {
p, err := s.Struct.Ptr(2)
return p.IsValid() || err != nil
}
func (s Commit) SetParent(v []byte) error {
return s.Struct.SetData(2, v)
}
func (s Commit) Root() ([]byte, error) {
p, err := s.Struct.Ptr(3)
return []byte(p.Data()), err
}
func (s Commit) HasRoot() bool {
p, err := s.Struct.Ptr(3)
return p.IsValid() || err != nil
}
func (s Commit) SetRoot(v []byte) error {
return s.Struct.SetData(3, v)
}
func (s Commit) Index() int64 {
return int64(s.Struct.Uint64(0))
}
func (s Commit) SetIndex(v int64) {
s.Struct.SetUint64(0, uint64(v))
}
func (s Commit) Merge() Commit_merge { return Commit_merge(s) }
func (s Commit_merge) With() (string, error) {
p, err := s.Struct.Ptr(4)
return p.Text(), err
}
func (s Commit_merge) HasWith() bool {
p, err := s.Struct.Ptr(4)
return p.IsValid() || err != nil
}
func (s Commit_merge) WithBytes() ([]byte, error) {
p, err := s.Struct.Ptr(4)
return p.TextBytes(), err
}
func (s Commit_merge) SetWith(v string) error {
return s.Struct.SetText(4, v)
}
func (s Commit_merge) Head() ([]byte, error) {
p, err := s.Struct.Ptr(5)
return []byte(p.Data()), err
}
func (s Commit_merge) HasHead() bool {
p, err := s.Struct.Ptr(5)
return p.IsValid() || err != nil
}
func (s Commit_merge) SetHead(v []byte) error {
return s.Struct.SetData(5, v)
}
// Commit_List is a list of Commit.
type Commit_List struct{ capnp.List }
// NewCommit creates a new list of Commit.
func NewCommit_List(s *capnp.Segment, sz int32) (Commit_List, error) {
l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 6}, sz)
return Commit_List{l}, err
}
func (s Commit_List) At(i int) Commit { return Commit{s.List.Struct(i)} }
func (s Commit_List) Set(i int, v Commit) error { return s.List.SetStruct(i, v.Struct) }
func (s Commit_List) String() string {
str, _ := text.MarshalList(0x8da013c66e545daf, s.List)
return str
}
// Commit_Promise is a wrapper for a Commit promised by a client call.
type Commit_Promise struct{ *capnp.Pipeline }
func (p Commit_Promise) Struct() (Commit, error) {
s, err := p.Pipeline.Struct()
return Commit{s}, err
}
func (p Commit_Promise) Merge() Commit_merge_Promise { return Commit_merge_Promise{p.Pipeline} }
// Commit_merge_Promise is a wrapper for a Commit_merge promised by a client call.
type Commit_merge_Promise struct{ *capnp.Pipeline }
func (p Commit_merge_Promise) Struct() (Commit_merge, error) {
s, err := p.Pipeline.Struct()
return Commit_merge{s}, err
}
// A single directory entry
type DirEntry struct{ capnp.Struct }
// DirEntry_TypeID is the unique identifier for the type DirEntry.
const DirEntry_TypeID = 0x8b15ee76774b1f9d
func NewDirEntry(s *capnp.Segment) (DirEntry, error) {
st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2})
return DirEntry{st}, err
}
func NewRootDirEntry(s *capnp.Segment) (DirEntry, error) {
st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2})
return DirEntry{st}, err
}
func ReadRootDirEntry(msg *capnp.Message) (DirEntry, error) {
root, err := msg.RootPtr()
return DirEntry{root.Struct()}, err
}
func (s DirEntry) String() string {
str, _ := text.Marshal(0x8b15ee76774b1f9d, s.Struct)
return str
}
func (s DirEntry) Name() (string, error) {
p, err := s.Struct.Ptr(0)
return p.Text(), err
}
func (s DirEntry) HasName() bool {
p, err := s.Struct.Ptr(0)
return p.IsValid() || err != nil
}
func (s DirEntry) NameBytes() ([]byte, error) {
p, err := s.Struct.Ptr(0)
return p.TextBytes(), err
}
func (s DirEntry) SetName(v string) error {
return s.Struct.SetText(0, v)
}
func (s DirEntry) Hash() ([]byte, error) {
p, err := s.Struct.Ptr(1)
return []byte(p.Data()), err
}
func (s DirEntry) HasHash() bool {
p, err := s.Struct.Ptr(1)
return p.IsValid() || err != nil
}
func (s DirEntry) SetHash(v []byte) error {
return s.Struct.SetData(1, v)
}
// DirEntry_List is a list of DirEntry.
type DirEntry_List struct{ capnp.List }
// NewDirEntry creates a new list of DirEntry.
func NewDirEntry_List(s *capnp.Segment, sz int32) (DirEntry_List, error) {
l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}, sz)
return DirEntry_List{l}, err
}
func (s DirEntry_List) At(i int) DirEntry { return DirEntry{s.List.Struct(i)} }
func (s DirEntry_List) Set(i int, v DirEntry) error { return s.List.SetStruct(i, v.Struct) }
func (s DirEntry_List) String() string {
str, _ := text.MarshalList(0x8b15ee76774b1f9d, s.List)
return str
}
// DirEntry_Promise is a wrapper for a DirEntry promised by a client call.
type DirEntry_Promise struct{ *capnp.Pipeline }
func (p DirEntry_Promise) Struct() (DirEntry, error) {
s, err := p.Pipeline.Struct()
return DirEntry{s}, err
}
// Directory contains one or more directories or files
type Directory struct{ capnp.Struct }
// Directory_TypeID is the unique identifier for the type Directory.
const Directory_TypeID = 0xe24c59306c829c01
func NewDirectory(s *capnp.Segment) (Directory, error) {
st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 3})
return Directory{st}, err
}
func NewRootDirectory(s *capnp.Segment) (Directory, error) {
st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 3})
return Directory{st}, err
}
func ReadRootDirectory(msg *capnp.Message) (Directory, error) {
root, err := msg.RootPtr()
return Directory{root.Struct()}, err
}
func (s Directory) String() string {
str, _ := text.Marshal(0xe24c59306c829c01, s.Struct)
return str
}
func (s Directory) Size() uint64 {
return s.Struct.Uint64(0)
}
func (s Directory) SetSize(v uint64) {
s.Struct.SetUint64(0, v)
}
func (s Directory) Parent() (string, error) {
p, err := s.Struct.Ptr(0)
return p.Text(), err
}
func (s Directory) HasParent() bool {
p, err := s.Struct.Ptr(0)
return p.IsValid() || err != nil
}
func (s Directory) ParentBytes() ([]byte, error) {
p, err := s.Struct.Ptr(0)
return p.TextBytes(), err
}
func (s Directory) SetParent(v string) error {
return s.Struct.SetText(0, v)
}
func (s Directory) Children() (DirEntry_List, error) {
p, err := s.Struct.Ptr(1)
return DirEntry_List{List: p.List()}, err
}
func (s Directory) HasChildren() bool {
p, err := s.Struct.Ptr(1)
return p.IsValid() || err != nil
}
func (s Directory) SetChildren(v DirEntry_List) error {
return s.Struct.SetPtr(1, v.List.ToPtr())
}
// NewChildren sets the children field to a newly
// allocated DirEntry_List, preferring placement in s's segment.
func (s Directory) NewChildren(n int32) (DirEntry_List, error) {
l, err := NewDirEntry_List(s.Struct.Segment(), n)
if err != nil {
return DirEntry_List{}, err
}
err = s.Struct.SetPtr(1, l.List.ToPtr())
return l, err
}
func (s Directory) Contents() (DirEntry_List, error) {
p, err := s.Struct.Ptr(2)
return DirEntry_List{List: p.List()}, err
}
func (s Directory) HasContents() bool {
p, err := s.Struct.Ptr(2)
return p.IsValid() || err != nil
}
func (s Directory) SetContents(v DirEntry_List) error {
return s.Struct.SetPtr(2, v.List.ToPtr())
}
// NewContents sets the contents field to a newly
// allocated DirEntry_List, preferring placement in s's segment.
func (s Directory) NewContents(n int32) (DirEntry_List, error) {
l, err := NewDirEntry_List(s.Struct.Segment(), n)
if err != nil {
return DirEntry_List{}, err
}
err = s.Struct.SetPtr(2, l.List.ToPtr())
return l, err
}
// Directory_List is a list of Directory.
type Directory_List struct{ capnp.List }
// NewDirectory creates a new list of Directory.
func NewDirectory_List(s *capnp.Segment, sz int32) (Directory_List, error) {
l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 3}, sz)
return Directory_List{l}, err
}
func (s Directory_List) At(i int) Directory { return Directory{s.List.Struct(i)} }
func (s Directory_List) Set(i int, v Directory) error { return s.List.SetStruct(i, v.Struct) }
func (s Directory_List) String() string {
str, _ := text.MarshalList(0xe24c59306c829c01, s.List)
return str
}
// Directory_Promise is a wrapper for a Directory promised by a client call.
type Directory_Promise struct{ *capnp.Pipeline }
func (p Directory_Promise) Struct() (Directory, error) {
s, err := p.Pipeline.Struct()
return Directory{s}, err
}
// A leaf node in the MDAG
type File struct{ capnp.Struct }
// File_TypeID is the unique identifier for the type File.
const File_TypeID = 0x8ea7393d37893155
func NewFile(s *capnp.Segment) (File, error) {
st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2})
return File{st}, err
}
func NewRootFile(s *capnp.Segment) (File, error) {
st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2})
return File{st}, err
}
func ReadRootFile(msg *capnp.Message) (File, error) {
root, err := msg.RootPtr()
return File{root.Struct()}, err
}
func (s File) String() string {
str, _ := text.Marshal(0x8ea7393d37893155, s.Struct)
return str
}
func (s File) Size() uint64 {
return s.Struct.Uint64(0)
}
func (s File) SetSize(v uint64) {
s.Struct.SetUint64(0, v)
}
func (s File) Parent() (string, error) {
p, err := s.Struct.Ptr(0)
return p.Text(), err
}
func (s File) HasParent() bool {
p, err := s.Struct.Ptr(0)
return p.IsValid() || err != nil
}
func (s File) ParentBytes() ([]byte, error) {
p, err := s.Struct.Ptr(0)
return p.TextBytes(), err
}
func (s File) SetParent(v string) error {
return s.Struct.SetText(0, v)
}
func (s File) Key() ([]byte, error) {
p, err := s.Struct.Ptr(1)
return []byte(p.Data()), err
}
func (s File) HasKey() bool {
p, err := s.Struct.Ptr(1)
return p.IsValid() || err != nil
}
func (s File) SetKey(v []byte) error {
return s.Struct.SetData(1, v)
}
// File_List is a list of File.
type File_List struct{ capnp.List }
// NewFile creates a new list of File.
func NewFile_List(s *capnp.Segment, sz int32) (File_List, error) {
l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2}, sz)
return File_List{l}, err
}
func (s File_List) At(i int) File { return File{s.List.Struct(i)} }
func (s File_List) Set(i int, v File) error { return s.List.SetStruct(i, v.Struct) }
func (s File_List) String() string {
str, _ := text.MarshalList(0x8ea7393d37893155, s.List)
return str
}
// File_Promise is a wrapper for a File promised by a client call.
type File_Promise struct{ *capnp.Pipeline }
func (p File_Promise) Struct() (File, error) {
s, err := p.Pipeline.Struct()
return File{s}, err
}
// Ghost indicates that a certain node was at this path once
type Ghost struct{ capnp.Struct }
type Ghost_Which uint16
const (
Ghost_Which_commit Ghost_Which = 0
Ghost_Which_directory Ghost_Which = 1
Ghost_Which_file Ghost_Which = 2
)
func (w Ghost_Which) String() string {
const s = "commitdirectoryfile"
switch w {
case Ghost_Which_commit:
return s[0:6]
case Ghost_Which_directory:
return s[6:15]
case Ghost_Which_file:
return s[15:19]
}
return "Ghost_Which(" + strconv.FormatUint(uint64(w), 10) + ")"
}
// Ghost_TypeID is the unique identifier for the type Ghost.
const Ghost_TypeID = 0x80c828d7e89c12ea
func NewGhost(s *capnp.Segment) (Ghost, error) {
st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 16, PointerCount: 2})
return Ghost{st}, err
}
func NewRootGhost(s *capnp.Segment) (Ghost, error) {
st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 16, PointerCount: 2})
return Ghost{st}, err
}
func ReadRootGhost(msg *capnp.Message) (Ghost, error) {
root, err := msg.RootPtr()
return Ghost{root.Struct()}, err
}
func (s Ghost) String() string {
str, _ := text.Marshal(0x80c828d7e89c12ea, s.Struct)
return str
}
func (s Ghost) Which() Ghost_Which {
return Ghost_Which(s.Struct.Uint16(8))
}
func (s Ghost) GhostInode() uint64 {
return s.Struct.Uint64(0)
}
func (s Ghost) SetGhostInode(v uint64) {
s.Struct.SetUint64(0, v)
}
func (s Ghost) GhostPath() (string, error) {
p, err := s.Struct.Ptr(0)
return p.Text(), err
}
func (s Ghost) HasGhostPath() bool {
p, err := s.Struct.Ptr(0)
return p.IsValid() || err != nil
}
func (s Ghost) GhostPathBytes() ([]byte, error) {
p, err := s.Struct.Ptr(0)
return p.TextBytes(), err
}
func (s Ghost) SetGhostPath(v string) error {
return s.Struct.SetText(0, v)
}
func (s Ghost) Commit() (Commit, error) {
if s.Struct.Uint16(8) != 0 {
panic("Which() != commit")
}
p, err := s.Struct.Ptr(1)
return Commit{Struct: p.Struct()}, err
}
func (s Ghost) HasCommit() bool {
if s.Struct.Uint16(8) != 0 {
return false
}
p, err := s.Struct.Ptr(1)
return p.IsValid() || err != nil
}
func (s Ghost) SetCommit(v Commit) error {
s.Struct.SetUint16(8, 0)
return s.Struct.SetPtr(1, v.Struct.ToPtr())
}
// NewCommit sets the commit field to a newly
// allocated Commit struct, preferring placement in s's segment.
func (s Ghost) NewCommit() (Commit, error) {
s.Struct.SetUint16(8, 0)
ss, err := NewCommit(s.Struct.Segment())
if err != nil {
return Commit{}, err
}
err = s.Struct.SetPtr(1, ss.Struct.ToPtr())
return ss, err
}
func (s Ghost) Directory() (Directory, error) {
if s.Struct.Uint16(8) != 1 {
panic("Which() != directory")
}
p, err := s.Struct.Ptr(1)
return Directory{Struct: p.Struct()}, err
}
func (s Ghost) HasDirectory() bool {
if s.Struct.Uint16(8) != 1 {
return false
}
p, err := s.Struct.Ptr(1)
return p.IsValid() || err != nil
}
func (s Ghost) SetDirectory(v Directory) error {
s.Struct.SetUint16(8, 1)
return s.Struct.SetPtr(1, v.Struct.ToPtr())
}
// NewDirectory sets the directory field to a newly
// allocated Directory struct, preferring placement in s's segment.
func (s Ghost) NewDirectory() (Directory, error) {
s.Struct.SetUint16(8, 1)
ss, err := NewDirectory(s.Struct.Segment())
if err != nil {
return Directory{}, err
}
err = s.Struct.SetPtr(1, ss.Struct.ToPtr())
return ss, err
}
func (s Ghost) File() (File, error) {
if s.Struct.Uint16(8) != 2 {
panic("Which() != file")
}
p, err := s.Struct.Ptr(1)
return File{Struct: p.Struct()}, err
}
func (s Ghost) HasFile() bool {
if s.Struct.Uint16(8) != 2 {
return false
}
p, err := s.Struct.Ptr(1)
return p.IsValid() || err != nil
}
func (s Ghost) SetFile(v File) error {
s.Struct.SetUint16(8, 2)
return s.Struct.SetPtr(1, v.Struct.ToPtr())
}
// NewFile sets the file field to a newly
// allocated File struct, preferring placement in s's segment.
func (s Ghost) NewFile() (File, error) {
s.Struct.SetUint16(8, 2)
ss, err := NewFile(s.Struct.Segment())
if err != nil {
return File{}, err
}
err = s.Struct.SetPtr(1, ss.Struct.ToPtr())
return ss, err
}
// Ghost_List is a list of Ghost.
type Ghost_List struct{ capnp.List }
// NewGhost creates a new list of Ghost.
func NewGhost_List(s *capnp.Segment, sz int32) (Ghost_List, error) {
l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 16, PointerCount: 2}, sz)
return Ghost_List{l}, err
}
func (s Ghost_List) At(i int) Ghost { return Ghost{s.List.Struct(i)} }
func (s Ghost_List) Set(i int, v Ghost) error { return s.List.SetStruct(i, v.Struct) }
func (s Ghost_List) String() string {
str, _ := text.MarshalList(0x80c828d7e89c12ea, s.List)
return str
}
// Ghost_Promise is a wrapper for a Ghost promised by a client call.
type Ghost_Promise struct{ *capnp.Pipeline }
func (p Ghost_Promise) Struct() (Ghost, error) {
s, err := p.Pipeline.Struct()
return Ghost{s}, err
}
func (p Ghost_Promise) Commit() Commit_Promise {
return Commit_Promise{Pipeline: p.Pipeline.GetPipeline(1)}
}
func (p Ghost_Promise) Directory() Directory_Promise {
return Directory_Promise{Pipeline: p.Pipeline.GetPipeline(1)}
}
func (p Ghost_Promise) File() File_Promise {
return File_Promise{Pipeline: p.Pipeline.GetPipeline(1)}
}
// Node is a node in the merkle dag of brig
type Node struct{ capnp.Struct }
type Node_Which uint16
const (
Node_Which_commit Node_Which = 0
Node_Which_directory Node_Which = 1
Node_Which_file Node_Which = 2
Node_Which_ghost Node_Which = 3
)
func (w Node_Which) String() string {
const s = "commitdirectoryfileghost"
switch w {
case Node_Which_commit:
return s[0:6]
case Node_Which_directory:
return s[6:15]
case Node_Which_file:
return s[15:19]
case Node_Which_ghost:
return s[19:24]
}
return "Node_Which(" + strconv.FormatUint(uint64(w), 10) + ")"
}
// Node_TypeID is the unique identifier for the type Node.
const Node_TypeID = 0xa629eb7f7066fae3
func NewNode(s *capnp.Segment) (Node, error) {
st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 16, PointerCount: 7})
return Node{st}, err
}
func NewRootNode(s *capnp.Segment) (Node, error) {
st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 16, PointerCount: 7})
return Node{st}, err
}
func ReadRootNode(msg *capnp.Message) (Node, error) {
root, err := msg.RootPtr()
return Node{root.Struct()}, err
}
func (s Node) String() string {
str, _ := text.Marshal(0xa629eb7f7066fae3, s.Struct)
return str
}
func (s Node) Which() Node_Which {
return Node_Which(s.Struct.Uint16(8))
}
func (s Node) Name() (string, error) {
p, err := s.Struct.Ptr(0)
return p.Text(), err
}
func (s Node) HasName() bool {
p, err := s.Struct.Ptr(0)
return p.IsValid() || err != nil
}
func (s Node) NameBytes() ([]byte, error) {
p, err := s.Struct.Ptr(0)
return p.TextBytes(), err
}
func (s Node) SetName(v string) error {
return s.Struct.SetText(0, v)
}
func (s Node) TreeHash() ([]byte, error) {
p, err := s.Struct.Ptr(1)
return []byte(p.Data()), err
}
func (s Node) HasTreeHash() bool {
p, err := s.Struct.Ptr(1)
return p.IsValid() || err != nil
}
func (s Node) SetTreeHash(v []byte) error {
return s.Struct.SetData(1, v)
}
func (s Node) ModTime() (string, error) {
p, err := s.Struct.Ptr(2)
return p.Text(), err
}
func (s Node) HasModTime() bool {
p, err := s.Struct.Ptr(2)
return p.IsValid() || err != nil
}
func (s Node) ModTimeBytes() ([]byte, error) {
p, err := s.Struct.Ptr(2)
return p.TextBytes(), err
}
func (s Node) SetModTime(v string) error {
return s.Struct.SetText(2, v)
}
func (s Node) Inode() uint64 {
return s.Struct.Uint64(0)
}
func (s Node) SetInode(v uint64) {
s.Struct.SetUint64(0, v)
}
func (s Node) ContentHash() ([]byte, error) {
p, err := s.Struct.Ptr(3)
return []byte(p.Data()), err
}
func (s Node) HasContentHash() bool {
p, err := s.Struct.Ptr(3)
return p.IsValid() || err != nil
}
func (s Node) SetContentHash(v []byte) error {
return s.Struct.SetData(3, v)
}
func (s Node) User() (string, error) {
p, err := s.Struct.Ptr(4)
return p.Text(), err
}
func (s Node) HasUser() bool {
p, err := s.Struct.Ptr(4)
return p.IsValid() || err != nil
}
func (s Node) UserBytes() ([]byte, error) {
p, err := s.Struct.Ptr(4)
return p.TextBytes(), err
}
func (s Node) SetUser(v string) error {
return s.Struct.SetText(4, v)
}
func (s Node) Commit() (Commit, error) {
if s.Struct.Uint16(8) != 0 {
panic("Which() != commit")
}
p, err := s.Struct.Ptr(5)
return Commit{Struct: p.Struct()}, err
}
func (s Node) HasCommit() bool {
if s.Struct.Uint16(8) != 0 {
return false
}
p, err := s.Struct.Ptr(5)
return p.IsValid() || err != nil
}
func (s Node) SetCommit(v Commit) error {
s.Struct.SetUint16(8, 0)
return s.Struct.SetPtr(5, v.Struct.ToPtr())
}
// NewCommit sets the commit field to a newly
// allocated Commit struct, preferring placement in s's segment.
func (s Node) NewCommit() (Commit, error) {
s.Struct.SetUint16(8, 0)
ss, err := NewCommit(s.Struct.Segment())
if err != nil {
return Commit{}, err
}
err = s.Struct.SetPtr(5, ss.Struct.ToPtr())
return ss, err
}
func (s Node) Directory() (Directory, error) {
if s.Struct.Uint16(8) != 1 {
panic("Which() != directory")
}
p, err := s.Struct.Ptr(5)
return Directory{Struct: p.Struct()}, err
}
func (s Node) HasDirectory() bool {
if s.Struct.Uint16(8) != 1 {
return false
}
p, err := s.Struct.Ptr(5)
return p.IsValid() || err != nil
}
func (s Node) SetDirectory(v Directory) error {
s.Struct.SetUint16(8, 1)
return s.Struct.SetPtr(5, v.Struct.ToPtr())
}
// NewDirectory sets the directory field to a newly
// allocated Directory struct, preferring placement in s's segment.
func (s Node) NewDirectory() (Directory, error) {
s.Struct.SetUint16(8, 1)
ss, err := NewDirectory(s.Struct.Segment())
if err != nil {
return Directory{}, err
}
err = s.Struct.SetPtr(5, ss.Struct.ToPtr())
return ss, err
}
func (s Node) File() (File, error) {
if s.Struct.Uint16(8) != 2 {
panic("Which() != file")
}
p, err := s.Struct.Ptr(5)
return File{Struct: p.Struct()}, err
}
func (s Node) HasFile() bool {
if s.Struct.Uint16(8) != 2 {
return false
}
p, err := s.Struct.Ptr(5)
return p.IsValid() || err != nil
}
func (s Node) SetFile(v File) error {
s.Struct.SetUint16(8, 2)
return s.Struct.SetPtr(5, v.Struct.ToPtr())
}
// NewFile sets the file field to a newly
// allocated File struct, preferring placement in s's segment.
func (s Node) NewFile() (File, error) {
s.Struct.SetUint16(8, 2)
ss, err := NewFile(s.Struct.Segment())
if err != nil {
return File{}, err
}
err = s.Struct.SetPtr(5, ss.Struct.ToPtr())
return ss, err
}
func (s Node) Ghost() (Ghost, error) {
if s.Struct.Uint16(8) != 3 {
panic("Which() != ghost")
}
p, err := s.Struct.Ptr(5)
return Ghost{Struct: p.Struct()}, err
}
func (s Node) HasGhost() bool {
if s.Struct.Uint16(8) != 3 {
return false
}
p, err := s.Struct.Ptr(5)
return p.IsValid() || err != nil
}
func (s Node) SetGhost(v Ghost) error {
s.Struct.SetUint16(8, 3)
return s.Struct.SetPtr(5, v.Struct.ToPtr())
}
// NewGhost sets the ghost field to a newly
// allocated Ghost struct, preferring placement in s's segment.
func (s Node) NewGhost() (Ghost, error) {
s.Struct.SetUint16(8, 3)
ss, err := NewGhost(s.Struct.Segment())
if err != nil {
return Ghost{}, err
}
err = s.Struct.SetPtr(5, ss.Struct.ToPtr())
return ss, err
}
func (s Node) BackendHash() ([]byte, error) {
p, err := s.Struct.Ptr(6)
return []byte(p.Data()), err
}
func (s Node) HasBackendHash() bool {
p, err := s.Struct.Ptr(6)
return p.IsValid() || err != nil
}
func (s Node) SetBackendHash(v []byte) error {
return s.Struct.SetData(6, v)
}
// Node_List is a list of Node.
type Node_List struct{ capnp.List }
// NewNode creates a new list of Node.