Skip to content

Commit

Permalink
Fix misspellings in code files
Browse files Browse the repository at this point in the history
Currently, we are doing an strict misspelling check on document files
but not on code files. According to intensive misspelling check on all
code files, catched 92 occurrences in 27 files and fixed.
  • Loading branch information
aleksdmladenovic committed Oct 18, 2024
1 parent f5de318 commit b0e6b0d
Show file tree
Hide file tree
Showing 29 changed files with 94 additions and 92 deletions.
6 changes: 3 additions & 3 deletions nativelink-config/src/cas_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ pub enum EnvironmentSource {
/// (requested by the client).
timeout_millis,

/// A special file path will be provided that can be used to comminicate
/// A special file path will be provided that can be used to communicate
/// with the parent process about out-of-band information. This file
/// will be read after the command has finished executing. Based on the
/// contents of the file, the behavior of the result may be modified.
Expand Down Expand Up @@ -665,7 +665,7 @@ pub enum WorkerConfig {
pub struct GlobalConfig {
/// Maximum number of open files that can be opened at one time.
/// This value is not strictly enforced, it is a best effort. Some internal libraries
/// open files or read metadata from a files which do not obay this limit, however
/// open files or read metadata from a files which do not obey this limit, however
/// the vast majority of cases will have this limit be honored.
/// As a rule of thumb this value should be less than half the value of `ulimit -n`.
/// Any network open file descriptors is not counted in this limit, but is counted
Expand Down Expand Up @@ -696,7 +696,7 @@ pub struct GlobalConfig {
/// are collected at runtime (performance metrics) from being tallied. The
/// overhead of collecting metrics is very low, so this flag should only be
/// used if there is a very good reason to disable metrics.
/// This flag can be forcably set using the `NATIVELINK_DISABLE_METRICS` variable.
/// This flag can be forcibly set using the `NATIVELINK_DISABLE_METRICS` variable.
/// If the variable is set it will always disable metrics regardless of what
/// this flag is set to.
///
Expand Down
10 changes: 5 additions & 5 deletions nativelink-scheduler/src/cache_lookup_scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ impl CacheLookupScheduler {
action_info: Arc<ActionInfo>,
) -> Result<Box<dyn ActionStateResult>, Error> {
let unique_key = match &action_info.unique_qualifier {
ActionUniqueQualifier::Cachable(unique_key) => unique_key.clone(),
ActionUniqueQualifier::Uncachable(_) => {
ActionUniqueQualifier::Cacheable(unique_key) => unique_key.clone(),
ActionUniqueQualifier::Uncacheable(_) => {
// Cache lookup skipped, forward to the upstream.
return self
.action_scheduler
Expand Down Expand Up @@ -214,12 +214,12 @@ impl CacheLookupScheduler {
let _scope_guard = scope_guard;

let unique_key = match &action_info.unique_qualifier {
ActionUniqueQualifier::Cachable(unique_key) => unique_key,
ActionUniqueQualifier::Uncachable(unique_key) => {
ActionUniqueQualifier::Cacheable(unique_key) => unique_key,
ActionUniqueQualifier::Uncacheable(unique_key) => {
event!(
Level::ERROR,
?action_info,
"ActionInfo::unique_qualifier should be ActionUniqueQualifier::Cachable()"
"ActionInfo::unique_qualifier should be ActionUniqueQualifier::Cacheable()"
);
unique_key
}
Expand Down
4 changes: 2 additions & 2 deletions nativelink-scheduler/src/grpc_scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ impl GrpcScheduler {
})
};
let skip_cache_lookup = match action_info.unique_qualifier {
ActionUniqueQualifier::Cachable(_) => false,
ActionUniqueQualifier::Uncachable(_) => true,
ActionUniqueQualifier::Cacheable(_) => false,
ActionUniqueQualifier::Uncacheable(_) => true,
};
let request = ExecuteRequest {
instance_name: action_info.instance_name().clone(),
Expand Down
20 changes: 10 additions & 10 deletions nativelink-scheduler/src/memory_awaited_action_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ impl<I: InstantWrapper, NowFn: Fn() -> I + Clone + Send + Sync> AwaitedActionDbI
let awaited_action = tx.borrow().clone();
// Cleanup action_info_hash_key_to_awaited_action if it was marked cached.
match &awaited_action.action_info().unique_qualifier {
ActionUniqueQualifier::Cachable(action_key) => {
ActionUniqueQualifier::Cacheable(action_key) => {
let maybe_awaited_action = self
.action_info_hash_key_to_awaited_action
.remove(action_key);
Expand All @@ -431,7 +431,7 @@ impl<I: InstantWrapper, NowFn: Fn() -> I + Clone + Send + Sync> AwaitedActionDbI
);
}
}
ActionUniqueQualifier::Uncachable(_action_key) => {
ActionUniqueQualifier::Uncacheable(_action_key) => {
// This Operation should not be in the hash_key map.
}
}
Expand Down Expand Up @@ -543,7 +543,7 @@ impl<I: InstantWrapper, NowFn: Fn() -> I + Clone + Send + Sync> AwaitedActionDbI
return Ok(());
}
match &new_awaited_action.action_info().unique_qualifier {
ActionUniqueQualifier::Cachable(action_key) => {
ActionUniqueQualifier::Cacheable(action_key) => {
let maybe_awaited_action =
action_info_hash_key_to_awaited_action.remove(action_key);
match maybe_awaited_action {
Expand All @@ -569,8 +569,8 @@ impl<I: InstantWrapper, NowFn: Fn() -> I + Clone + Send + Sync> AwaitedActionDbI
}
Ok(())
}
ActionUniqueQualifier::Uncachable(_action_key) => {
// If we are not cachable, the action should not be in the
ActionUniqueQualifier::Uncacheable(_action_key) => {
// If we are not cacheable, the action should not be in the
// hash_key map, so we don't need to process anything in
// action_info_hash_key_to_awaited_action.
Ok(())
Expand Down Expand Up @@ -691,8 +691,8 @@ impl<I: InstantWrapper, NowFn: Fn() -> I + Clone + Send + Sync> AwaitedActionDbI
}

let maybe_unique_key = match &action_info.unique_qualifier {
ActionUniqueQualifier::Cachable(unique_key) => Some(unique_key.clone()),
ActionUniqueQualifier::Uncachable(_unique_key) => None,
ActionUniqueQualifier::Cacheable(unique_key) => Some(unique_key.clone()),
ActionUniqueQualifier::Uncacheable(_unique_key) => None,
};
let operation_id = OperationId::default();
let awaited_action =
Expand All @@ -718,7 +718,7 @@ impl<I: InstantWrapper, NowFn: Fn() -> I + Clone + Send + Sync> AwaitedActionDbI
.insert(client_operation_id.clone(), client_awaited_action)
.await;

// Note: We only put items in the map that are cachable.
// Note: We only put items in the map that are cacheable.
if let Some(unique_key) = maybe_unique_key {
let old_value = self
.action_info_hash_key_to_awaited_action
Expand Down Expand Up @@ -761,8 +761,8 @@ impl<I: InstantWrapper, NowFn: Fn() -> I + Clone + Send + Sync> AwaitedActionDbI
_priority: i32,
) -> Result<Option<MemoryAwaitedActionSubscriber<I, NowFn>>, Error> {
let unique_key = match unique_qualifier {
ActionUniqueQualifier::Cachable(unique_key) => unique_key,
ActionUniqueQualifier::Uncachable(_unique_key) => return Ok(None),
ActionUniqueQualifier::Cacheable(unique_key) => unique_key,
ActionUniqueQualifier::Uncacheable(_unique_key) => return Ok(None),
};

let Some(operation_id) = self.action_info_hash_key_to_awaited_action.get(unique_key) else {
Expand Down
8 changes: 4 additions & 4 deletions nativelink-scheduler/src/simple_scheduler_state_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ fn apply_filter_predicate(awaited_action: &AwaitedAction, filter: &OperationFilt
{
if let Some(filter_unique_key) = &filter.unique_key {
match &awaited_action.action_info().unique_qualifier {
ActionUniqueQualifier::Cachable(unique_key) => {
ActionUniqueQualifier::Cacheable(unique_key) => {
if filter_unique_key != unique_key {
return false;
}
}
ActionUniqueQualifier::Uncachable(_) => {
ActionUniqueQualifier::Uncacheable(_) => {
return false;
}
}
Expand Down Expand Up @@ -806,9 +806,9 @@ where
async fn assign_operation(
&self,
operation_id: &OperationId,
worker_id_or_reason_for_unsassign: Result<&WorkerId, Error>,
worker_id_or_reason_for_unassign: Result<&WorkerId, Error>,
) -> Result<(), Error> {
let (maybe_worker_id, update) = match worker_id_or_reason_for_unsassign {
let (maybe_worker_id, update) = match worker_id_or_reason_for_unassign {
Ok(worker_id) => (
Some(worker_id),
UpdateOperationType::UpdateWithActionStage(ActionStage::Executing),
Expand Down
8 changes: 4 additions & 4 deletions nativelink-scheduler/src/store_awaited_action_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ impl SchedulerStoreDataProvider for UpdateOperationIdToAwaitedAction {
fn get_indexes(&self) -> Result<Vec<(&'static str, Bytes)>, Error> {
let unique_qualifier = &self.0.action_info().unique_qualifier;
let maybe_unique_qualifier = match &unique_qualifier {
ActionUniqueQualifier::Cachable(_) => Some(unique_qualifier),
ActionUniqueQualifier::Uncachable(_) => None,
ActionUniqueQualifier::Cacheable(_) => Some(unique_qualifier),
ActionUniqueQualifier::Uncacheable(_) => None,
};
let mut output = Vec::with_capacity(1 + maybe_unique_qualifier.map_or(0, |_| 1));
if maybe_unique_qualifier.is_some() {
Expand Down Expand Up @@ -357,8 +357,8 @@ impl<S: SchedulerStore, F: Fn() -> OperationId> StoreAwaitedActionDb<S, F> {
_priority: i32,
) -> Result<Option<OperationSubscriber<S>>, Error> {
match unique_qualifier {
ActionUniqueQualifier::Cachable(_) => {}
ActionUniqueQualifier::Uncachable(_) => return Ok(None),
ActionUniqueQualifier::Cacheable(_) => {}
ActionUniqueQualifier::Uncacheable(_) => return Ok(None),
}
let stream = self
.store
Expand Down
2 changes: 1 addition & 1 deletion nativelink-scheduler/tests/action_messages_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use pretty_assertions::assert_eq;

#[nativelink_test]
async fn action_state_any_url_test() -> Result<(), Error> {
let unique_qualifier = ActionUniqueQualifier::Cachable(ActionUniqueKey {
let unique_qualifier = ActionUniqueQualifier::Cacheable(ActionUniqueKey {
instance_name: "foo_instance".to_string(),
digest_function: DigestHasherFunc::Sha256,
digest: DigestInfo::new([1u8; 32], 5),
Expand Down
4 changes: 2 additions & 2 deletions nativelink-scheduler/tests/cache_lookup_scheduler_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ async fn add_action_handles_skip_cache() -> Result<(), Error> {
stage: ActionStage::Queued,
action_digest: action_info.unique_qualifier.digest(),
}));
let ActionUniqueQualifier::Cachable(action_key) = action_info.unique_qualifier.clone() else {
let ActionUniqueQualifier::Cacheable(action_key) = action_info.unique_qualifier.clone() else {
panic!("This test should be testing when item was cached first");
};
let mut skip_cache_action = action_info.as_ref().clone();
skip_cache_action.unique_qualifier = ActionUniqueQualifier::Uncachable(action_key);
skip_cache_action.unique_qualifier = ActionUniqueQualifier::Uncacheable(action_key);
let skip_cache_action = Arc::new(skip_cache_action);
let client_operation_id = OperationId::default();
let _ = join!(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ async fn add_action_smoke_test() -> Result<(), Error> {
priority: 0,
load_timestamp: SystemTime::UNIX_EPOCH,
insert_timestamp: SystemTime::UNIX_EPOCH,
unique_qualifier: ActionUniqueQualifier::Cachable(ActionUniqueKey {
unique_qualifier: ActionUniqueQualifier::Cacheable(ActionUniqueKey {
instance_name: INSTANCE_NAME.to_string(),
digest_function: DigestHasherFunc::Sha256,
digest: DigestInfo::zero_digest(),
Expand Down
2 changes: 1 addition & 1 deletion nativelink-scheduler/tests/utils/scheduler_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub fn make_base_action_info(
priority: 0,
load_timestamp: UNIX_EPOCH,
insert_timestamp,
unique_qualifier: ActionUniqueQualifier::Cachable(ActionUniqueKey {
unique_qualifier: ActionUniqueQualifier::Cacheable(ActionUniqueKey {
instance_name: INSTANCE_NAME.to_string(),
digest_function: DigestHasherFunc::Sha256,
digest: action_digest,
Expand Down
4 changes: 2 additions & 2 deletions nativelink-service/src/execution_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ impl InstanceInfo {
digest: action_digest,
};
let unique_qualifier = if skip_cache_lookup {
ActionUniqueQualifier::Uncachable(action_key)
ActionUniqueQualifier::Uncacheable(action_key)
} else {
ActionUniqueQualifier::Cachable(action_key)
ActionUniqueQualifier::Cacheable(action_key)
};

Ok(ActionInfo {
Expand Down
2 changes: 1 addition & 1 deletion nativelink-service/tests/worker_api_server_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ pub async fn execution_response_success_test() -> Result<(), Box<dyn std::error:
let action_digest = DigestInfo::new([7u8; 32], 123);
let instance_name = "instance_name".to_string();

let unique_qualifier = ActionUniqueQualifier::Uncachable(ActionUniqueKey {
let unique_qualifier = ActionUniqueQualifier::Uncacheable(ActionUniqueKey {
instance_name: instance_name.clone(),
digest_function: DigestHasherFunc::Sha256,
digest: action_digest,
Expand Down
54 changes: 27 additions & 27 deletions nativelink-util/src/action_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,13 @@ impl TryFrom<String> for WorkerId {
}

/// Holds the information needed to uniquely identify an action
/// and if it is cachable or not.
/// and if it is cacheable or not.
#[derive(Debug, Clone, Hash, PartialEq, Eq, Serialize, Deserialize)]
pub enum ActionUniqueQualifier {
/// The action is cachable.
Cachable(ActionUniqueKey),
/// The action is uncachable.
Uncachable(ActionUniqueKey),
/// The action is cacheable.
Cacheable(ActionUniqueKey),
/// The action is uncacheable.
Uncacheable(ActionUniqueKey),
}

impl MetricsComponent for ActionUniqueQualifier {
Expand All @@ -195,15 +195,15 @@ impl MetricsComponent for ActionUniqueQualifier {
_kind: MetricKind,
field_metadata: MetricFieldData,
) -> Result<MetricPublishKnownKindData, nativelink_metric::Error> {
let (cachable, action) = match self {
Self::Cachable(action) => (true, action),
Self::Uncachable(action) => (false, action),
let (cacheable, action) = match self {
Self::Cacheable(action) => (true, action),
Self::Uncacheable(action) => (false, action),
};
publish!(
cachable,
&cachable,
cacheable,
&cacheable,
MetricKind::Default,
"If the action is cachable.",
"If the action is cacheable.",
""
);
action.publish(MetricKind::Component, field_metadata)?;
Expand All @@ -215,33 +215,33 @@ impl ActionUniqueQualifier {
/// Get the instance_name of the action.
pub const fn instance_name(&self) -> &String {
match self {
Self::Cachable(action) => &action.instance_name,
Self::Uncachable(action) => &action.instance_name,
Self::Cacheable(action) => &action.instance_name,
Self::Uncacheable(action) => &action.instance_name,
}
}

/// Get the digest function of the action.
pub const fn digest_function(&self) -> DigestHasherFunc {
match self {
Self::Cachable(action) => action.digest_function,
Self::Uncachable(action) => action.digest_function,
Self::Cacheable(action) => action.digest_function,
Self::Uncacheable(action) => action.digest_function,
}
}

/// Get the digest of the action.
pub const fn digest(&self) -> DigestInfo {
match self {
Self::Cachable(action) => action.digest,
Self::Uncachable(action) => action.digest,
Self::Cacheable(action) => action.digest,
Self::Uncacheable(action) => action.digest,
}
}
}

impl std::fmt::Display for ActionUniqueQualifier {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let (cachable, unique_key) = match self {
Self::Cachable(action) => (true, action),
Self::Uncachable(action) => (false, action),
let (cacheable, unique_key) = match self {
Self::Cacheable(action) => (true, action),
Self::Uncacheable(action) => (false, action),
};
f.write_fmt(format_args!(
// Note: We use underscores because it makes escaping easier
Expand All @@ -251,7 +251,7 @@ impl std::fmt::Display for ActionUniqueQualifier {
unique_key.digest_function,
unique_key.digest.packed_hash(),
unique_key.digest.size_bytes(),
if cachable { 'c' } else { 'u' },
if cacheable { 'c' } else { 'u' },
))
}
}
Expand Down Expand Up @@ -308,9 +308,9 @@ pub struct ActionInfo {
/// When this action was created.
#[metric(help = "When this action was created.")]
pub insert_timestamp: SystemTime,
/// Info used to uniquely identify this ActionInfo and if it is cachable.
/// Info used to uniquely identify this ActionInfo and if it is cacheable.
/// This is primarily used to join actions/operations together using this key.
#[metric(help = "Info used to uniquely identify this ActionInfo and if it is cachable.")]
#[metric(help = "Info used to uniquely identify this ActionInfo and if it is cacheable.")]
pub unique_qualifier: ActionUniqueQualifier,
}

Expand Down Expand Up @@ -342,9 +342,9 @@ impl ActionInfo {
.try_into()?,
};
let unique_qualifier = if execute_request.skip_cache_lookup {
ActionUniqueQualifier::Uncachable(unique_key)
ActionUniqueQualifier::Uncacheable(unique_key)
} else {
ActionUniqueQualifier::Cachable(unique_key)
ActionUniqueQualifier::Cacheable(unique_key)
};

let proto_properties = action.platform.unwrap_or_default();
Expand Down Expand Up @@ -383,8 +383,8 @@ impl From<&ActionInfo> for ExecuteRequest {
fn from(val: &ActionInfo) -> Self {
let digest = val.digest().into();
let (skip_cache_lookup, unique_qualifier) = match &val.unique_qualifier {
ActionUniqueQualifier::Cachable(unique_qualifier) => (false, unique_qualifier),
ActionUniqueQualifier::Uncachable(unique_qualifier) => (true, unique_qualifier),
ActionUniqueQualifier::Cacheable(unique_qualifier) => (false, unique_qualifier),
ActionUniqueQualifier::Uncacheable(unique_qualifier) => (true, unique_qualifier),
};
Self {
instance_name: unique_qualifier.instance_name.clone(),
Expand Down
2 changes: 1 addition & 1 deletion nativelink-util/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ impl Serialize for DigestInfo {
}
}

/// Custom deserializer for `DigestInfo` becaues the default Deserializer
/// Custom deserializer for `DigestInfo` because the default Deserializer
/// would try to decode the data as a byte array, but we use {hex}-{size}.
impl<'de> Deserialize<'de> for DigestInfo {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
Expand Down
2 changes: 1 addition & 1 deletion nativelink-util/src/digest_hasher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use crate::common::DigestInfo;
use crate::origin_context::{ActiveOriginContext, OriginContext};
use crate::{fs, make_symbol, spawn_blocking};

// The symbol can be use to retrieve the active hasher function.
// The symbol can be used to retrieve the active hasher function.
// from an `OriginContext`.
make_symbol!(ACTIVE_HASHER_FUNC, DigestHasherFunc);

Expand Down
2 changes: 1 addition & 1 deletion nativelink-util/src/fastcdc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl State {
/// In layman's terms this means we can take an input of unknown size and composition
/// and chunk it into smaller chunks with chunk boundaries that will be very similar
/// even when a small part of the file is changed. This use cases where a large file
/// (say 1G) has a few minor changes weather they byte inserts, deletes or updates
/// (say 1G) has a few minor changes whether they byte inserts, deletes or updates
/// and when running through this algorithm it will slice the file up so that under
/// normal conditions all the chunk boundaries will be identical except the ones near
/// the mutations.
Expand Down
Loading

0 comments on commit b0e6b0d

Please sign in to comment.