pub struct DataFileContent {
pub path: DataFilePath,
pub commit: GitCommitId,
pub bytes: u64,
pub total_lines: u64,
pub sha256: Sha256Hex,
pub note: Option<String>,
pub lines: Option<LineRange>,
pub partial_line: Option<u64>,
pub text: String,
pub omitted_bytes: u64,
pub cut: Option<String>,
pub asked: Option<String>,
}Expand description
One file of a data set (DATA-…), as get_content serves it: checked
against its signed SHA-256, then cut to the byte budget if it is longer
(0.91). With lines, only those lines (0.103)
Fields§
§path: DataFilePath§commit: GitCommitIdThe commit it was read at, as the manifest pins it
bytes: u64The whole file’s size in bytes
total_lines: u64The whole file’s lines (0.103; 0 from an older server)
sha256: Sha256HexThe whole file’s SHA-256, as signed; the bytes read matched it
note: Option<String>§lines: Option<LineRange>The lines text holds, for a read of some lines (lines=): the
range asked for, its end clamped to the file’s last line and cut
back to the last whole line the budget holds (0.103). Absent when
text is only the start of one line (partial_line),
so that it never names a line not shown whole (0.105.0)
partial_line: Option<u64>For a read of some lines whose first line alone is over the
budget: that line’s number. text is its start, cut inside it, and
holds no whole line (0.105.0)
text: StringThe file’s text, or as much of it as the budget holds
omitted_bytes: u64Bytes of the file not in text: 0 when it is whole
cut: Option<String>When text is cut: where, and how much more there is
asked: Option<String>The attachment= asked for, when it is not path: a path relative
to a directory at the repository root, resolved (0.91.4)
Implementations§
Source§impl DataFileContent
impl DataFileContent
Sourcepub fn new(
set: &GovernanceLogId,
commit: GitCommitId,
file: &DataFile,
bytes: &[u8],
budget: usize,
lines: Option<LineRange>,
) -> Result<Self, DataFileReadError>
pub fn new( set: &GovernanceLogId, commit: GitCommitId, file: &DataFile, bytes: &[u8], budget: usize, lines: Option<LineRange>, ) -> Result<Self, DataFileReadError>
file’s bytes, already checked,
as text of at most budget bytes: the whole file, or with lines
those lines. A whole read cut by the budget falls at the end of a
line when one ends in the budget’s second half, else at a character
boundary; a range is cut back to its last whole line that fits (or,
when its first line alone does not, at a character boundary). A
whole read of a file over
MAX_WHOLE_READ_BYTES is
refused, saying which range fits (0.103). set is the data set the
file is read from, for the citation form the refusal shows.
Source§impl DataFileContent
impl DataFileContent
Sourcepub fn citation(&self, set: &GovernanceLogId) -> DataCitation
pub fn citation(&self, set: &GovernanceLogId) -> DataCitation
How to cite what this read served, in the canonical form: set,
the commit read at (its first seven hex digits) and the path, with
the lines served when it is a read of some lines (0.110.0)
Source§impl DataFileContent
impl DataFileContent
Sourcepub fn refuse_whole(
set: &GovernanceLogId,
commit: GitCommitId,
file: &DataFile,
lines: Option<LineRange>,
) -> Option<DataFileReadError>
pub fn refuse_whole( set: &GovernanceLogId, commit: GitCommitId, file: &DataFile, lines: Option<LineRange>, ) -> Option<DataFileReadError>
The refusal of a whole read (lines absent) of a file listed over
MAX_WHOLE_READ_BYTES, from
the listing alone: a server calls this before it reads the blob, so
a refused read costs nothing (the review of 0.103)
Trait Implementations§
Source§impl Clone for DataFileContent
impl Clone for DataFileContent
Source§impl Debug for DataFileContent
impl Debug for DataFileContent
Source§impl<'de> Deserialize<'de> for DataFileContent
impl<'de> Deserialize<'de> for DataFileContent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for DataFileContent
Source§impl PartialEq for DataFileContent
impl PartialEq for DataFileContent
Source§impl Serialize for DataFileContent
impl Serialize for DataFileContent
impl StructuralPartialEq for DataFileContent
Auto Trait Implementations§
impl Freeze for DataFileContent
impl RefUnwindSafe for DataFileContent
impl Send for DataFileContent
impl Sync for DataFileContent
impl Unpin for DataFileContent
impl UnsafeUnpin for DataFileContent
impl UnwindSafe for DataFileContent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.