Skip to content

Commit

Permalink
Update hashbrown to 0.15
Browse files Browse the repository at this point in the history
  • Loading branch information
coolreader18 committed Oct 8, 2024
1 parent 4db4c9a commit ab3a0a8
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 36 deletions.
50 changes: 30 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ futures = "0.3"
futures-channel = "0.3"
getrandom = "0.2.7"
glob = "0.3.1"
hashbrown = "0.14"
hashbrown = { version = "0.15", default-features = false, features = ["equivalent", "inline-more"] }
headers = "0.4"
heck = "0.4"
hex = "0.4.3"
Expand Down
2 changes: 1 addition & 1 deletion crates/client-api/src/routes/prometheus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{log_and_500, ControlStateReadAccess};
use axum::extract::State;
use axum::response::IntoResponse;
use serde::{Deserialize, Serialize};
use spacetimedb_data_structures::map::HashMap;
use spacetimedb_data_structures::map::{HashCollectionExt, HashMap};

#[derive(Serialize, Deserialize)]
struct SDConfig {
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/db/relational_operators.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use core::marker::PhantomData;
use spacetimedb_data_structures::map::HashSet;
use spacetimedb_data_structures::map::{HashCollectionExt, HashSet};
use spacetimedb_sats::ProductValue;

// NOTE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
use spacetimedb_client_api_messages::websocket::{
BsatnFormat, CompressableQueryUpdate, FormatSwitch, JsonFormat, QueryUpdate,
};
use spacetimedb_data_structures::map::{Entry, HashMap, HashSet, IntMap};
use spacetimedb_data_structures::map::{Entry, HashCollectionExt, HashMap, HashSet, IntMap};
use spacetimedb_lib::{Address, Identity};
use spacetimedb_primitives::TableId;
use std::sync::Arc;
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/subscription/subscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use anyhow::Context;
use itertools::Either;
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
use spacetimedb_client_api_messages::websocket::WebsocketFormat;
use spacetimedb_data_structures::map::HashSet;
use spacetimedb_data_structures::map::{HashCollectionExt, HashSet};
use spacetimedb_lib::db::auth::{StAccess, StTableType};
use spacetimedb_lib::db::error::AuthError;
use spacetimedb_lib::identity::AuthCtx;
Expand Down
1 change: 1 addition & 0 deletions crates/data-structures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ description = "Assorted data structures used in spacetimedb"
serde = ["dep:serde"]

[dependencies]
ahash.workspace = true
hashbrown.workspace = true
nohash-hasher.workspace = true
serde = { workspace = true, optional = true }
Expand Down
9 changes: 6 additions & 3 deletions crates/data-structures/src/map.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
use core::hash::BuildHasher;
pub use hashbrown::hash_map::{DefaultHashBuilder, Entry, RawEntryMut};
pub use hashbrown::{HashMap, HashSet};
use core::hash::{BuildHasher, BuildHasherDefault};
pub use hashbrown::hash_map::Entry;
use nohash_hasher::BuildNoHashHasher;
pub use nohash_hasher::IsEnabled as ValidAsIdentityHash;

pub type DefaultHashBuilder = BuildHasherDefault<ahash::AHasher>;
pub type HashMap<K, V, S = DefaultHashBuilder> = hashbrown::HashMap<K, V, S>;
pub type HashSet<T, S = DefaultHashBuilder> = hashbrown::HashSet<T, S>;

/// A version of [`HashMap<K, V>`] using the identity hash function,
/// which is valid for any key type that can be converted to a `u64` without truncation.
pub type IntMap<K, V> = HashMap<K, V, BuildNoHashHasher<K>>;
Expand Down
2 changes: 1 addition & 1 deletion crates/lib/src/relation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::db::error::{RelationError, TypeError};
use core::fmt;
use core::hash::Hash;
use derive_more::From;
use spacetimedb_data_structures::map::HashSet;
use spacetimedb_data_structures::map::{HashCollectionExt, HashSet};
use spacetimedb_primitives::{ColId, ColList, ColSet, Constraints, TableId};
use spacetimedb_sats::algebraic_value::AlgebraicValue;
use spacetimedb_sats::satn::Satn;
Expand Down
2 changes: 1 addition & 1 deletion crates/schema/src/type_for_generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use petgraph::{
use smallvec::SmallVec;
use spacetimedb_data_structures::{
error_stream::{CollectAllErrors, CombineErrors, ErrorStream},
map::{HashMap, HashSet},
map::{HashCollectionExt, HashMap, HashSet},
};
use spacetimedb_lib::{AlgebraicType, ProductTypeElement};
use spacetimedb_sats::{typespace::TypeRefError, AlgebraicTypeRef, ArrayType, SumTypeVariant, Typespace};
Expand Down
2 changes: 1 addition & 1 deletion crates/sdk/src/spacetime_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{
};
use anyhow::Context;
use bytes::Bytes;
use spacetimedb_data_structures::map::HashMap;
use spacetimedb_data_structures::map::{HashCollectionExt, HashMap};
use spacetimedb_lib::{bsatn, de::DeserializeOwned};
use std::{any::Any, fmt::Debug, hash::Hash};

Expand Down
2 changes: 1 addition & 1 deletion crates/table/src/btree_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ mod test {
use core::ops::Bound::*;
use proptest::prelude::*;
use proptest::{collection::vec, test_runner::TestCaseResult};
use spacetimedb_data_structures::map::HashMap;
use spacetimedb_data_structures::map::{HashCollectionExt, HashMap};
use spacetimedb_primitives::ColId;
use spacetimedb_sats::{
product,
Expand Down
2 changes: 1 addition & 1 deletion crates/table/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use core::hash::{Hash, Hasher};
use core::ops::RangeBounds;
use core::{fmt, ptr};
use derive_more::{Add, AddAssign, From, Sub};
use spacetimedb_data_structures::map::HashMap;
use spacetimedb_data_structures::map::{HashCollectionExt, HashMap};
use spacetimedb_lib::{bsatn::DecodeError, de::DeserializeOwned};
use spacetimedb_primitives::{ColId, ColList, IndexId};
use spacetimedb_sats::{
Expand Down
2 changes: 1 addition & 1 deletion crates/testing/src/sdk.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use duct::cmd;
use lazy_static::lazy_static;
use rand::distributions::{Alphanumeric, DistString};
use spacetimedb_data_structures::map::HashMap;
use spacetimedb_data_structures::map::{HashCollectionExt, HashMap};
use std::fs::create_dir_all;
use std::sync::Mutex;
use std::thread::JoinHandle;
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use core::slice::from_ref;
use derive_more::From;
use itertools::Itertools;
use smallvec::SmallVec;
use spacetimedb_data_structures::map::{HashSet, IntMap};
use spacetimedb_data_structures::map::{HashCollectionExt, HashSet, IntMap};
use spacetimedb_lib::db::auth::{StAccess, StTableType};
use spacetimedb_lib::db::error::{AuthError, RelationError};
use spacetimedb_lib::relation::{ColExpr, DbTable, FieldName, Header};
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/rel_ops.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use core::iter;

use crate::relation::RelValue;
use spacetimedb_data_structures::map::HashMap;
use spacetimedb_data_structures::map::{HashCollectionExt, HashMap};
use spacetimedb_lib::relation::ColExpr;
use spacetimedb_sats::AlgebraicValue;

Expand Down

0 comments on commit ab3a0a8

Please sign in to comment.