Skip to content

Commit

Permalink
Rename neardata server feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Sliman4 committed Jun 15, 2024
1 parent ad9c77d commit 068b82e
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 27 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ temp-file = "0.1.8"
[features]
default = []
message-provider = []
fastnear-data-server = [ "message-provider", "reqwest" ]
neardata-server = [ "message-provider", "reqwest" ]
lake = [ "message-provider", "near-lake-framework" ]

[[example]]
name = "watch-the-slime"
path = "examples/watch_the_slime.rs"
required-features = [ "fastnear-data-server" ]
required-features = [ "neardata-server" ]

[[example]]
name = "watch-the-slime-lake"
Expand All @@ -45,12 +45,12 @@ required-features = [ "lake" ]
[[example]]
name = "ft-transfers"
path = "examples/ft_transfers.rs"
required-features = [ "fastnear-data-server" ]
required-features = [ "neardata-server" ]

[[example]]
name = "download"
path = "examples/download.rs"
required-features = [ "fastnear-data-server" ]
required-features = [ "neardata-server" ]

[package.metadata.docs.rs]
all-features = true
4 changes: 2 additions & 2 deletions examples/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use std::path::PathBuf;

use async_trait::async_trait;
use inindexer::{
fastnear_data_server::FastNearDataServerProvider,
near_utils::{MAINNET_GENESIS_BLOCK_HEIGHT, TESTNET_GENESIS_BLOCK_HEIGHT},
neardata_server::NeardataServerProvider,
run_indexer, AutoContinue, BlockIterator, Indexer, IndexerOptions,
};
use near_indexer_primitives::{types::BlockHeight, StreamerMessage};
Expand Down Expand Up @@ -130,7 +130,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {

run_indexer(
&mut indexer,
FastNearDataServerProvider::mainnet(),
NeardataServerProvider::mainnet(),
IndexerOptions {
range,
stop_on_error: true,
Expand Down
4 changes: 2 additions & 2 deletions examples/ft_transfers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use std::path::PathBuf;

use async_trait::async_trait;
use inindexer::{
fastnear_data_server::FastNearDataServerProvider,
near_utils::{EventLogData, FtTransferLog, MAINNET_GENESIS_BLOCK_HEIGHT},
neardata_server::NeardataServerProvider,
run_indexer, AutoContinue, BlockIterator, Indexer, IndexerOptions,
};
use near_indexer_primitives::{views::ExecutionStatusView, StreamerMessage};
Expand Down Expand Up @@ -68,7 +68,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {

run_indexer(
&mut indexer,
FastNearDataServerProvider::mainnet(),
NeardataServerProvider::mainnet(),
IndexerOptions {
range: BlockIterator::AutoContinue(AutoContinue {
save_location: Box::new(PathBuf::from("example_ft_trasnfers_last_block.txt")),
Expand Down
6 changes: 3 additions & 3 deletions examples/watch_the_slime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

use async_trait::async_trait;
use inindexer::{
fastnear_data_server::FastNearDataServerProvider, run_indexer, BlockIterator,
CompleteTransaction, Indexer, IndexerOptions,
neardata_server::NeardataServerProvider, run_indexer, BlockIterator, CompleteTransaction,
Indexer, IndexerOptions,
};
use near_indexer_primitives::{types::AccountId, StreamerMessage};

Expand Down Expand Up @@ -44,7 +44,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {

run_indexer(
&mut indexer,
FastNearDataServerProvider::mainnet(),
NeardataServerProvider::mainnet(),
IndexerOptions {
range: BlockIterator::iterator(112_037_807..=112_037_810),
..Default::default()
Expand Down
22 changes: 11 additions & 11 deletions src/indexer_tests.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#[cfg(not(feature = "fastnear-data-server"))]
compile_error!("Use `cargo test --all-features` to run tests. If you want to skip AWS Lake test, run with `cargo test --features fastnear-data-server`");
#[cfg(not(feature = "neardata-server"))]
compile_error!("Use `cargo test --all-features` to run tests. If you want to skip AWS Lake test, run with `cargo test --features neardata-server`");

use std::{collections::HashMap, ops::Range, path::PathBuf};

#[cfg(feature = "lake")]
use crate::lake::LakeStreamer;
use crate::{
fastnear_data_server::FastNearDataServerProvider, message_provider::ParallelProviderStreamer,
near_utils::MAINNET_GENESIS_BLOCK_HEIGHT, AutoContinue, AutoContinueEnd, BlockIterator,
message_provider::ParallelProviderStreamer, near_utils::MAINNET_GENESIS_BLOCK_HEIGHT,
neardata_server::NeardataServerProvider, AutoContinue, AutoContinueEnd, BlockIterator,
CompleteTransaction, IndexerOptions, PreprocessTransactionsSettings,
};
use async_trait::async_trait;
Expand All @@ -19,7 +19,7 @@ use near_indexer_primitives::{
use crate::{run_indexer, Indexer};

#[tokio::test]
async fn fastnear_data_server_provider() {
async fn neardata_server_provider() {
const RANGE: Range<BlockHeight> =
MAINNET_GENESIS_BLOCK_HEIGHT..(MAINNET_GENESIS_BLOCK_HEIGHT + 10);

Expand All @@ -43,7 +43,7 @@ async fn fastnear_data_server_provider() {

run_indexer(
&mut indexer,
FastNearDataServerProvider::mainnet(),
NeardataServerProvider::mainnet(),
IndexerOptions {
range: BlockIterator::iterator(RANGE),
preprocess_transactions: None,
Expand Down Expand Up @@ -124,7 +124,7 @@ async fn parallel_provider_with_correct_order() {

run_indexer(
&mut indexer,
ParallelProviderStreamer::new(FastNearDataServerProvider::mainnet(), 3),
ParallelProviderStreamer::new(NeardataServerProvider::mainnet(), 3),
IndexerOptions {
range: BlockIterator::iterator(RANGE),
preprocess_transactions: None,
Expand Down Expand Up @@ -161,7 +161,7 @@ async fn auto_continue() {

run_indexer(
&mut indexer,
FastNearDataServerProvider::mainnet(),
NeardataServerProvider::mainnet(),
IndexerOptions {
range: BlockIterator::AutoContinue(AutoContinue {
save_location: Box::new(PathBuf::from(save_path)),
Expand All @@ -181,7 +181,7 @@ async fn auto_continue() {

run_indexer(
&mut indexer,
FastNearDataServerProvider::mainnet(),
NeardataServerProvider::mainnet(),
IndexerOptions {
range: BlockIterator::AutoContinue(AutoContinue {
save_location: Box::new(PathBuf::from(save_path)),
Expand Down Expand Up @@ -286,7 +286,7 @@ async fn prefetch_and_postfetch_dont_process_blocks() {

run_indexer(
&mut indexer,
FastNearDataServerProvider::mainnet(),
NeardataServerProvider::mainnet(),
IndexerOptions {
range: BlockIterator::iterator(RANGE),
preprocess_transactions: Some(PreprocessTransactionsSettings {
Expand Down Expand Up @@ -333,7 +333,7 @@ async fn preprocessing_should_supply_completed_transaction() {

run_indexer(
&mut indexer,
FastNearDataServerProvider::mainnet(),
NeardataServerProvider::mainnet(),
IndexerOptions {
range: BlockIterator::iterator(116_917_957..=116_917_962),
preprocess_transactions: Some(PreprocessTransactionsSettings {
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
//!
//! This crate only works with tokio runtime.

#[cfg(feature = "fastnear-data-server")]
pub mod fastnear_data_server;
mod indexer_state;
#[cfg(test)]
mod indexer_tests;
Expand All @@ -31,6 +29,8 @@ pub mod lake;
pub mod message_provider;
pub mod multiindexer;
pub mod near_utils;
#[cfg(feature = "neardata-server")]
pub mod neardata_server;

use std::{
collections::HashMap,
Expand Down
6 changes: 3 additions & 3 deletions src/fastnear_data_server.rs → src/neardata_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ use near_indexer_primitives::{types::BlockHeight, StreamerMessage};

use crate::message_provider::MessageProvider;

pub struct FastNearDataServerProvider {
pub struct NeardataServerProvider {
base_url: String,
client: reqwest::Client,
}

impl FastNearDataServerProvider {
impl NeardataServerProvider {
pub fn with_base_url(base_url: String) -> Self {
Self::with_base_url_and_client(
base_url,
Expand Down Expand Up @@ -48,7 +48,7 @@ impl FastNearDataServerProvider {
}

#[async_trait]
impl MessageProvider for FastNearDataServerProvider {
impl MessageProvider for NeardataServerProvider {
type Error = FastNearDataServerError;

async fn get_message(
Expand Down

0 comments on commit 068b82e

Please sign in to comment.