mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2025-04-04 15:35:18 +00:00
Compare commits
5 Commits
284f8ac5f7
...
9b2c3a6c7c
Author | SHA1 | Date | |
---|---|---|---|
![]() |
9b2c3a6c7c | ||
![]() |
898350e271 | ||
![]() |
14226dbddc | ||
![]() |
608195f536 | ||
![]() |
d230105b98 |
@ -34,7 +34,7 @@ pub struct AppendMerkleTree<E: HashElement, A: Algorithm<E>> {
|
|||||||
/// `revert_to` can reset the state correctly when needed.
|
/// `revert_to` can reset the state correctly when needed.
|
||||||
min_depth: Option<usize>,
|
min_depth: Option<usize>,
|
||||||
/// Used to compute the correct padding hash.
|
/// Used to compute the correct padding hash.
|
||||||
/// 0 for `pora_chunk_merkle` and 10 for not-first `last_chunk_merkle`.
|
/// 0 for `first_chunk_merkle` and 10 for not-first `last_chunk_merkle`.
|
||||||
leaf_height: usize,
|
leaf_height: usize,
|
||||||
_a: PhantomData<A>,
|
_a: PhantomData<A>,
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ where
|
|||||||
self.insert_at(key, self.default_entry_timeout);
|
self.insert_at(key, self.default_entry_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Inserts an entry that will expire at a given instant. If the entry already exists, the
|
/// Inserts an entry that will expire at a given duration. If the entry already exists, the
|
||||||
/// timeout is updated.
|
/// timeout is updated.
|
||||||
pub fn insert_at(&mut self, key: K, entry_duration: Duration) {
|
pub fn insert_at(&mut self, key: K, entry_duration: Duration) {
|
||||||
if self.contains(&key) {
|
if self.contains(&key) {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
//!
|
//!
|
||||||
//! - `Histogram`: used with `start_timer(..)` and `stop_timer(..)` to record durations (e.g.,
|
//! - `Histogram`: used with `start_timer(..)` and `stop_timer(..)` to record durations (e.g.,
|
||||||
//! block processing time).
|
//! block processing time).
|
||||||
//! - `IncCounter`: used to represent an ideally ever-growing, never-shrinking integer (e.g.,
|
//! - `IntCounter`: used to represent an ideally ever-growing, never-shrinking integer (e.g.,
|
||||||
//! number of block processing requests).
|
//! number of block processing requests).
|
||||||
//! - `IntGauge`: used to represent a varying integer (e.g., number of attestations per block).
|
//! - `IntGauge`: used to represent a varying integer (e.g., number of attestations per block).
|
||||||
//!
|
//!
|
||||||
@ -78,7 +78,7 @@ pub fn try_create_int_counter(name: &str, help: &str) -> Result<IntCounter> {
|
|||||||
Ok(counter)
|
Ok(counter)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Attempts to create an `IntGauge`, returning `Err` if the registry does not accept the counter
|
/// Attempts to create an `IntGauge`, returning `Err` if the registry does not accept the gauge
|
||||||
/// (potentially due to naming conflict).
|
/// (potentially due to naming conflict).
|
||||||
pub fn try_create_int_gauge(name: &str, help: &str) -> Result<IntGauge> {
|
pub fn try_create_int_gauge(name: &str, help: &str) -> Result<IntGauge> {
|
||||||
let opts = Opts::new(name, help);
|
let opts = Opts::new(name, help);
|
||||||
@ -87,7 +87,7 @@ pub fn try_create_int_gauge(name: &str, help: &str) -> Result<IntGauge> {
|
|||||||
Ok(gauge)
|
Ok(gauge)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Attempts to create a `Gauge`, returning `Err` if the registry does not accept the counter
|
/// Attempts to create a `Gauge`, returning `Err` if the registry does not accept the gauge
|
||||||
/// (potentially due to naming conflict).
|
/// (potentially due to naming conflict).
|
||||||
pub fn try_create_float_gauge(name: &str, help: &str) -> Result<Gauge> {
|
pub fn try_create_float_gauge(name: &str, help: &str) -> Result<Gauge> {
|
||||||
let opts = Opts::new(name, help);
|
let opts = Opts::new(name, help);
|
||||||
@ -96,7 +96,7 @@ pub fn try_create_float_gauge(name: &str, help: &str) -> Result<Gauge> {
|
|||||||
Ok(gauge)
|
Ok(gauge)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Attempts to create a `Histogram`, returning `Err` if the registry does not accept the counter
|
/// Attempts to create a `Histogram`, returning `Err` if the registry does not accept the histogram
|
||||||
/// (potentially due to naming conflict).
|
/// (potentially due to naming conflict).
|
||||||
pub fn try_create_histogram(name: &str, help: &str) -> Result<Histogram> {
|
pub fn try_create_histogram(name: &str, help: &str) -> Result<Histogram> {
|
||||||
let opts = HistogramOpts::new(name, help);
|
let opts = HistogramOpts::new(name, help);
|
||||||
@ -105,7 +105,7 @@ pub fn try_create_histogram(name: &str, help: &str) -> Result<Histogram> {
|
|||||||
Ok(histogram)
|
Ok(histogram)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Attempts to create a `HistogramVec`, returning `Err` if the registry does not accept the counter
|
/// Attempts to create a `HistogramVec`, returning `Err` if the registry does not accept the histogram
|
||||||
/// (potentially due to naming conflict).
|
/// (potentially due to naming conflict).
|
||||||
pub fn try_create_histogram_vec(
|
pub fn try_create_histogram_vec(
|
||||||
name: &str,
|
name: &str,
|
||||||
@ -144,7 +144,7 @@ pub fn try_create_float_gauge_vec(
|
|||||||
Ok(counter_vec)
|
Ok(counter_vec)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Attempts to create a `IntCounterVec`, returning `Err` if the registry does not accept the gauge
|
/// Attempts to create a `IntCounterVec`, returning `Err` if the registry does not accept the counter
|
||||||
/// (potentially due to naming conflict).
|
/// (potentially due to naming conflict).
|
||||||
pub fn try_create_int_counter_vec(
|
pub fn try_create_int_counter_vec(
|
||||||
name: &str,
|
name: &str,
|
||||||
|
@ -11,7 +11,7 @@ pub fn unused_tcp_port() -> Result<u16, String> {
|
|||||||
unused_port(Transport::Tcp)
|
unused_port(Transport::Tcp)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A convenience function for `unused_port(Transport::Tcp)`.
|
/// A convenience function for `unused_port(Transport::Udp)`.
|
||||||
pub fn unused_udp_port() -> Result<u16, String> {
|
pub fn unused_udp_port() -> Result<u16, String> {
|
||||||
unused_port(Transport::Udp)
|
unused_port(Transport::Udp)
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
ZeroGravity system consists of a data availability layer (0G DA) on top of a decentralized storage system (0G Storage). There is a separate consensus network that is part of both the 0G DA and the 0G Storage. For 0G Storage, the consensus is responsible for determining the ordering of the uploaded data blocks, realizing the storage mining verification and the corresponding incentive mechanism through smart contracts.
|
ZeroGravity system consists of a data availability layer (0G DA) on top of a decentralized storage system (0G Storage). There is a separate consensus network that is part of both the 0G DA and the 0G Storage. For 0G Storage, the consensus is responsible for determining the ordering of the uploaded data blocks, realizing the storage mining verification and the corresponding incentive mechanism through smart contracts.
|
||||||
|
|
||||||
Figure 1 illustrates the architecture of the 0G system. When a data block enters the 0G DA, it is first erasure coded and organized into multiple consecutive chunks through erasure coding. The merkle root as a commitment of the encoded data block is then submitted to the consensus layer to keep the order of the data entering the system. The chunks are then dispersed to different storage nodes in 0G Storage where the data may be further replicated to other nodes depending on the storage fee that the user pays. The storage nodes periodically participate the mining process by interacting with the consensus network to accrue rewards from the system.
|
Figure 1 illustrates the architecture of the 0G system. When a data block enters the 0G DA, it is first erasure coded and organized into multiple consecutive chunks through erasure coding. The merkle root as a commitment of the encoded data block is then submitted to the consensus layer to keep the order of the data entering the system. The chunks are then dispersed to different storage nodes in 0G Storage where the data may be further replicated to other nodes depending on the storage fee that the user pays. The storage nodes periodically participate in the mining process by interacting with the consensus network to accrue rewards from the system.
|
||||||
|
|
||||||
<figure><img src="../.gitbook/assets/zg-storage-architecture.png" alt=""><figcaption><p>Figure 1. The Architecture of 0G System</p></figcaption></figure>
|
<figure><img src="../.gitbook/assets/zg-storage-architecture.png" alt=""><figcaption><p>Figure 1. The Architecture of 0G System</p></figcaption></figure>
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ enum SlotStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Sliding window is used to control the concurrent uploading process of a file.
|
/// Sliding window is used to control the concurrent uploading process of a file.
|
||||||
/// Bounded window allows segments to be uploaded concurrenly, while having a capacity
|
/// Bounded window allows segments to be uploaded concurrently, while having a capacity
|
||||||
/// limit on writing threads per file. Meanwhile, the left_boundary field records
|
/// limit on writing threads per file. Meanwhile, the left_boundary field records
|
||||||
/// how many segments have been uploaded.
|
/// how many segments have been uploaded.
|
||||||
struct CtrlWindow {
|
struct CtrlWindow {
|
||||||
@ -165,7 +165,7 @@ impl ChunkPoolWriteCtrl {
|
|||||||
|
|
||||||
if file_ctrl.total_segments != total_segments {
|
if file_ctrl.total_segments != total_segments {
|
||||||
bail!(
|
bail!(
|
||||||
"file size in segment doesn't match with file size declared in previous segment. Previous total segments:{}, current total segments:{}s",
|
"file size in segment doesn't match with file size declared in previous segment. Previous total segments:{}, current total segments:{}",
|
||||||
file_ctrl.total_segments,
|
file_ctrl.total_segments,
|
||||||
total_segments
|
total_segments
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user