Skip to main content

gear_common/storage/primitives/
mod.rs

1// Copyright (C) Gear Technologies Inc.
2// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
3
4//! Gear storage primitives.
5//!
6//! Contains basic behavior of interaction with globally shared data,
7//! which could be used directly for common purposes or be a part of
8//! some consistent logic.
9
10// Private modules declaration.
11mod callback;
12mod counted;
13mod double_map;
14mod iterable;
15mod key;
16mod map;
17mod triple_map;
18mod value;
19
20// Public exports from primitive modules.
21pub use callback::{Callback, EmptyCallback, FallibleCallback, GetCallback, TransposeCallback};
22pub use counted::{Counted, CountedByKey};
23pub use double_map::DoubleMapStorage;
24
25#[cfg(feature = "std")]
26pub use double_map::auxiliary_double_map::*;
27
28pub use iterable::{
29    GetFirstPos, GetSecondPos, GetThirdPos, IterableByKeyMap, IterableMap, IteratorWrap,
30    KeyIterableByKeyMap,
31};
32pub use key::{KeyFor, MailboxKeyGen, QueueKeyGen, WaitlistKeyGen};
33pub use map::{AppendMapStorage, MapStorage};
34pub use triple_map::TripleMapStorage;
35pub use value::ValueStorage;
36
37use sp_runtime::{
38    codec::{self, Decode, Encode, MaxEncodedLen},
39    scale_info::{self, TypeInfo},
40};
41
42/// Type for interval values: e.g. in time `(since, till)`.
43#[derive(Clone, Debug, Decode, Encode, MaxEncodedLen, PartialEq, Eq, PartialOrd, Ord, TypeInfo)]
44#[codec(crate = codec)]
45#[scale_info(crate = scale_info)]
46pub struct Interval<T> {
47    pub start: T,
48    pub finish: T,
49}