Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
BlockReference.cs
1using System;
2using System.Text;
4
6{
10 [CollectionName(BlockReferencesCollection)]
11 [NoBackup("Actual blocks are not included in a backup. By not including these records, blocks will be re-fetched after a restore.")]
12 [TypeName(TypeNameSerialization.None)]
13 [Index("Digest")]
14 [Index("Expires")]
15 [Index("FileName", "Creator", "AccessDenied", "Unpacked")]
16 [Index("Creator", "AccessDenied", "Unpacked", "Created")]
17 [Index("Creator", "AccessDenied", "Created")]
18 [Index("Collection", "Creator", "Created")]
19 [Index("Collection", "Created")]
20 [Index("Created")]
22 {
26 public const string BlockReferencesCollection = "BlockReferences";
27
28 private string objectId = null;
29 private string fileName = string.Empty;
30 private byte[] digest = null;
31 private byte[] signature = null;
32 private string[] sources = null;
33 private ulong bytes = 0;
34 private bool accessDenied = false;
35 private bool unpacked = false;
36
41 {
42 }
43
52 public BlockReference(BlockHeader Header, string FileName, byte[] Digest, byte[] Signature, ulong Bytes)
53 {
54 this.Creator = Header.Creator;
55 this.Collection = Header.Collection;
56 this.Created = Header.Created;
57 this.Updated = Header.Updated;
58 this.Expires = Header.Expires;
59 this.Status = Header.Status;
60 this.Link = Header.Link;
61
62 this.fileName = FileName;
63 this.digest = Digest;
64 this.signature = Signature;
65 this.bytes = Bytes;
66 }
67
71 [ObjectId]
72 public string ObjectId
73 {
74 get => this.objectId;
75 set => this.objectId = value;
76 }
77
81 public string FileName
82 {
83 get => this.fileName;
84 set => this.fileName = value;
85 }
86
90 public byte[] Digest
91 {
92 get => this.digest;
93 set => this.digest = value;
94 }
95
99 public byte[] Signature
100 {
101 get => this.signature;
102 set => this.signature = value;
103 }
104
108 [DefaultValueNull]
109 public string[] Sources
110 {
111 get => this.sources;
112 set => this.sources = value;
113 }
114
118 [DefaultValue(0UL)]
119 public ulong Bytes
120 {
121 get => this.bytes;
122 set => this.bytes = value;
123 }
124
128 public bool AccessDenied
129 {
130 get => this.accessDenied;
131 set => this.accessDenied = value;
132 }
133
137 public bool Unpacked
138 {
139 get => this.unpacked;
140 set => this.unpacked = value;
141 }
142
146 public override string ToString()
147 {
148 StringBuilder sb = new StringBuilder();
149
150 sb.Append("Filename: ");
151 sb.Append(this.fileName ?? string.Empty);
152 sb.Append(", Digest: ");
153 sb.Append(Convert.ToBase64String(this.digest ?? new byte[0]));
154
155 return sb.ToString();
156 }
157
158 }
159}
byte[] Link
Link to updated block (in case Status shows the block has been updated).
Definition: BlockHeader.cs:120
string Creator
Creator of the block.
Definition: BlockHeader.cs:55
BlockStatus Status
Claimed status of block.
Definition: BlockHeader.cs:108
DateTime Created
When the block was created.
Definition: BlockHeader.cs:75
DateTime Expires
When the block expires.
Definition: BlockHeader.cs:97
DateTime Updated
When the block was updated (in case Status shows the block has been updated or deleted).
Definition: BlockHeader.cs:87
Contains a reference to a block in the ledger.
bool AccessDenied
If access to the block was denied.
BlockReference()
Contains a reference to a block in the ledger.
bool Unpacked
If objects in the block have been unpacked.
const string BlockReferencesCollection
Collection housing all block references.
BlockReference(BlockHeader Header, string FileName, byte[] Digest, byte[] Signature, ulong Bytes)
Contains a reference to a block in the ledger.
TypeNameSerialization
How the type name should be serialized.