pub struct Metadata {Show 14 fields
pub version: u8,
pub dataset: String,
pub schema: Option<Schema>,
pub start: u64,
pub end: Option<NonZeroU64>,
pub limit: Option<NonZeroU64>,
pub stype_in: Option<SType>,
pub stype_out: SType,
pub ts_out: bool,
pub symbol_cstr_len: usize,
pub symbols: Vec<String>,
pub partial: Vec<String>,
pub not_found: Vec<String>,
pub mappings: Vec<SymbolMapping>,
}Expand description
Information about the data contained in a DBN file or stream. DBN requires the Metadata to be included at the start of the encoded data.
Fields§
§version: u8The DBN schema version number. Newly-encoded DBN files will use
crate::DBN_VERSION.
dataset: StringThe dataset code.
schema: Option<Schema>The data record schema. Specifies which record types are in the DBN stream.
None indicates the DBN stream may contain more than one record type.
start: u64The UNIX nanosecond timestamp of the query start, or the first record if the file was split.
end: Option<NonZeroU64>The UNIX nanosecond timestamp of the query end, or the last record if the file was split.
limit: Option<NonZeroU64>The optional maximum number of records for the query.
stype_in: Option<SType>The input symbology type to map from. None indicates a mix, such as in the
case of live data.
stype_out: STypeThe output symbology type to map to.
ts_out: booltrue if this store contains live data with send timestamps appended to each
record.
symbol_cstr_len: usizeThe length in bytes of fixed-length symbol strings, including a null terminator byte.
symbols: Vec<String>The original query input symbols from the request.
partial: Vec<String>Symbols that did not resolve for at least one day in the query time range.
not_found: Vec<String>Symbols that did not resolve for any day in the query time range.
mappings: Vec<SymbolMapping>Symbol mappings containing a raw symbol and its mapping intervals.
Implementations§
source§impl Metadata
impl Metadata
sourcepub fn builder() -> MetadataBuilder<Unset, Unset, Unset, Unset, Unset>
pub fn builder() -> MetadataBuilder<Unset, Unset, Unset, Unset, Unset>
Creates a builder for building Metadata. Call .dataset(...), .schema(...),
.start(...) .stype_in(...), and .stype_out(...) on the builder to set the
required fields. Finally call .build() to create the Metadata instance.
sourcepub fn start(&self) -> OffsetDateTime
pub fn start(&self) -> OffsetDateTime
Parses the raw query start into a datetime.
sourcepub fn end(&self) -> Option<OffsetDateTime>
pub fn end(&self) -> Option<OffsetDateTime>
Parses the raw query end time or the timestamp of the last record into a
datetime. Returns None if the end time was not specified.
sourcepub fn symbol_map_for_date(&self, date: Date) -> Result<PitSymbolMap>
pub fn symbol_map_for_date(&self, date: Date) -> Result<PitSymbolMap>
Creates a symbology mapping from instrument ID to text symbol for the given date.
This method is useful when working with a historical request over a single day
or in other situations where you’re sure the mappings don’t change during the
time range of the request. Otherwise, Self::symbol_map() is recommmended.
§Errors
This function returns an error if stype_out is not SType::InstrumentId or
it can’t parse a symbol into a u32 instrument ID. It will also return an error
if date is outside the query range.
sourcepub fn symbol_map(&self) -> Result<TsSymbolMap>
pub fn symbol_map(&self) -> Result<TsSymbolMap>
Creates a symbology mapping from instrument ID and date to text symbol.
If you’re working with a single date or otherwise don’t expect the mappings to
change, Self::symbol_map_for_date() is recommended.
§Errors
This function returns an error if stype_out is not SType::InstrumentId or
it can’t parse a symbol into a u32 instrument ID.
sourcepub fn upgrade(&mut self, upgrade_policy: VersionUpgradePolicy)
pub fn upgrade(&mut self, upgrade_policy: VersionUpgradePolicy)
Upgrades the metadata according to upgrade_policy if necessary.
Trait Implementations§
source§impl PyClassImpl for Metadata
impl PyClassImpl for Metadata
source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
§type ThreadChecker = SendablePyClass<Metadata>
type ThreadChecker = SendablePyClass<Metadata>
§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
§type BaseNativeType = PyAny
type BaseNativeType = PyAny
gil-refs only.PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
source§impl PyClassNewTextSignature<Metadata> for PyClassImplCollector<Metadata>
Available on crate feature python only.
impl PyClassNewTextSignature<Metadata> for PyClassImplCollector<Metadata>
python only.fn new_text_signature(self) -> Option<&'static str>
source§impl PyMethods<Metadata> for PyClassImplCollector<Metadata>
Available on crate feature python only.
impl PyMethods<Metadata> for PyClassImplCollector<Metadata>
python only.fn py_methods(self) -> &'static PyClassItems
source§impl PyTypeInfo for Metadata
impl PyTypeInfo for Metadata
source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
source§fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
source§impl TryFrom<&Metadata> for TsSymbolMap
impl TryFrom<&Metadata> for TsSymbolMap
impl DerefToPyAny for Metadata
impl Eq for Metadata
impl StructuralPartialEq for Metadata
Auto Trait Implementations§
impl Freeze for Metadata
impl RefUnwindSafe for Metadata
impl Send for Metadata
impl Sync for Metadata
impl Unpin for Metadata
impl UnwindSafe for Metadata
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)