Skip to content

Commit

Permalink
Follow changes in all crates
Browse files Browse the repository at this point in the history
  • Loading branch information
vigoo committed Dec 12, 2024
1 parent c66512b commit 75202be
Show file tree
Hide file tree
Showing 43 changed files with 307 additions and 220 deletions.
4 changes: 2 additions & 2 deletions golem-api-grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ description = "GRPC API for Golem services"
harness = false

[dependencies]
golem-wasm-ast = { path = "../wasm-ast", version = "0.0.0" }
golem-wasm-rpc = { path = "../wasm-rpc", version = "0.0.0", default-features = false, features = ["host"] }
golem-wasm-ast = { path = "../wasm-ast", version = "0.0.0", default-features = false, features = ["protobuf"] }
golem-wasm-rpc = { path = "../wasm-rpc", version = "0.0.0", default-features = false, features = ["protobuf"] }

async-trait = { workspace = true }
bincode = { workspace = true }
Expand Down
8 changes: 3 additions & 5 deletions golem-cli/src/model/invoke_result_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use golem_wasm_rpc::{protobuf, print_type_annotated_value};
use golem_wasm_rpc::{print_type_annotated_value, protobuf};
use serde::{Deserialize, Serialize};
use serde_json::value::Value;
use tracing::{debug, info};
Expand Down Expand Up @@ -122,7 +122,7 @@ mod tests {
use golem_wasm_rpc::protobuf::type_annotated_value::TypeAnnotatedValue;
use golem_wasm_rpc::protobuf::TypeAnnotatedValue as RootTypeAnnotatedValue;
use golem_wasm_rpc::protobuf::TypedTuple;
use golem_wasm_rpc::{TypeAnnotatedValueConstructors, Uri};
use golem_wasm_rpc::TypeAnnotatedValueConstructors;
use uuid::Uuid;

use golem_client::model::{
Expand Down Expand Up @@ -195,9 +195,7 @@ mod tests {
fn fallback_to_json() {
let res = parse(
vec![golem_wasm_rpc::Value::Handle {
uri: Uri {
value: "".to_string(),
},
uri: "".to_string(),
resource_id: 1,
}],
vec![handle(AnalysedResourceId(1), AnalysedResourceMode::Owned)],
Expand Down
2 changes: 1 addition & 1 deletion golem-cli/src/service/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ use golem_common::uri::oss::url::{ComponentUrl, WorkerUrl};
use golem_common::uri::oss::urn::{ComponentUrn, WorkerUrn};
use golem_wasm_ast::analysis::{AnalysedExport, AnalysedFunction, AnalysedInstance};
use golem_wasm_rpc::json::TypeAnnotatedValueJsonExtensions;
use golem_wasm_rpc::protobuf::type_annotated_value::TypeAnnotatedValue;
use golem_wasm_rpc::parse_type_annotated_value;
use golem_wasm_rpc::protobuf::type_annotated_value::TypeAnnotatedValue;
use itertools::Itertools;
use serde_json::Value;
use std::sync::Arc;
Expand Down
13 changes: 7 additions & 6 deletions golem-common/src/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use golem_wasm_ast::analysis::analysed_type::{
};
use golem_wasm_ast::analysis::{analysed_type, AnalysedType};
use golem_wasm_rpc::IntoValue;
use http::Uri;
use rand::prelude::IteratorRandom;
use serde::de::Unexpected;
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
Expand All @@ -39,7 +40,6 @@ use std::fmt::{Display, Formatter};
use std::ops::Add;
use std::str::FromStr;
use std::time::{Duration, SystemTime};
use http::Uri;
use typed_path::Utf8UnixPathBuf;
use uuid::{uuid, Uuid};

Expand Down Expand Up @@ -70,8 +70,11 @@ pub trait PoemTypeRequirements:
pub trait PoemTypeRequirements {}

#[cfg(feature = "poem")]
impl<T: poem_openapi::types::Type + poem_openapi::types::ParseFromJSON + poem_openapi::types::ToJSON>
PoemTypeRequirements for T
impl<
T: poem_openapi::types::Type
+ poem_openapi::types::ParseFromJSON
+ poem_openapi::types::ToJSON,
> PoemTypeRequirements for T
{
}

Expand Down Expand Up @@ -2242,8 +2245,7 @@ mod tests {
use crate::model::oplog::OplogIndex;

use crate::model::{
AccountId, ComponentFilePath, ComponentFilePermissions, ComponentId, Empty,
FilterComparator, IdempotencyKey, InitialComponentFile, InitialComponentFileKey, ShardId,
AccountId, ComponentFilePath, ComponentId, FilterComparator, IdempotencyKey, ShardId,
StringFilterComparator, TargetWorkerId, Timestamp, WorkerFilter, WorkerId, WorkerMetadata,
WorkerStatus, WorkerStatusRecord,
};
Expand Down Expand Up @@ -2579,5 +2581,4 @@ mod tests {
let path = ComponentFilePath::from_abs_str("a/b/c");
assert!(path.is_err());
}

}
17 changes: 3 additions & 14 deletions golem-common/src/model/oplog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::model::RetryConfig;
use crate::model::regions::OplogRegion;
use crate::model::RetryConfig;
use crate::model::{
AccountId, ComponentVersion, IdempotencyKey, PluginInstallationId, Timestamp, WorkerId,
WorkerInvocation,
Expand Down Expand Up @@ -199,18 +199,7 @@ impl<'de> BorrowDecode<'de> for PayloadId {
}

#[derive(
Debug,
Clone,
Copy,
PartialOrd,
Ord,
PartialEq,
Eq,
Hash,
Encode,
Decode,
Serialize,
Deserialize,
Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash, Encode, Decode, Serialize, Deserialize,
)]
#[cfg_attr(feature = "poem", derive(poem_openapi::NewType))]
pub struct WorkerResourceId(pub u64);
Expand Down Expand Up @@ -856,4 +845,4 @@ mod protobuf {
}
}
}
}
}
12 changes: 10 additions & 2 deletions golem-common/src/model/protobuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,22 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use std::ops::Add;
use crate::model::oplog::OplogIndex;
use crate::model::{AccountId, ComponentFilePath, ComponentFilePermissions, ComponentFileSystemNode, ComponentFileSystemNodeDetails, ComponentType, FilterComparator, GatewayBindingType, IdempotencyKey, InitialComponentFile, InitialComponentFileKey, LogLevel, NumberOfShards, Pod, PromiseId, RoutingTable, RoutingTableEntry, ScanCursor, ShardId, StringFilterComparator, TargetWorkerId, Timestamp, WorkerCreatedAtFilter, WorkerEnvFilter, WorkerEvent, WorkerFilter, WorkerId, WorkerNameFilter, WorkerNotFilter, WorkerStatus, WorkerStatusFilter, WorkerVersionFilter};
use crate::model::{
AccountId, ComponentFilePath, ComponentFilePermissions, ComponentFileSystemNode,
ComponentFileSystemNodeDetails, ComponentType, FilterComparator, GatewayBindingType,
IdempotencyKey, InitialComponentFile, InitialComponentFileKey, LogLevel, NumberOfShards, Pod,
PromiseId, RoutingTable, RoutingTableEntry, ScanCursor, ShardId, StringFilterComparator,
TargetWorkerId, Timestamp, WorkerCreatedAtFilter, WorkerEnvFilter, WorkerEvent, WorkerFilter,
WorkerId, WorkerNameFilter, WorkerNotFilter, WorkerStatus, WorkerStatusFilter,
WorkerVersionFilter,
};
use golem_api_grpc::proto::golem;
use golem_api_grpc::proto::golem::shardmanager::{
Pod as GrpcPod, RoutingTable as GrpcRoutingTable, RoutingTableEntry as GrpcRoutingTableEntry,
};
use golem_api_grpc::proto::golem::worker::Cursor;
use std::ops::Add;
use std::time::{Duration, SystemTime};

impl From<Timestamp> for prost_types::Timestamp {
Expand Down
25 changes: 18 additions & 7 deletions golem-common/src/model/public_oplog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::model::RetryConfig;
use crate::model::lucene::{LeafQuery, Query};
use crate::model::oplog::{LogLevel, OplogIndex, WorkerResourceId, WrappedFunctionType};
use crate::model::plugin::PluginInstallation;
use crate::model::regions::OplogRegion;
use crate::model::RetryConfig;
use crate::model::{
AccountId, ComponentVersion, Empty, IdempotencyKey, PluginInstallationId, Timestamp, WorkerId,
};
Expand Down Expand Up @@ -2449,17 +2449,28 @@ mod protobuf {
mod tests {
use test_r::test;

use crate::model::public_oplog::{
ChangeRetryPolicyParameters, CreateParameters, DescribeResourceParameters,
EndRegionParameters, ErrorParameters, ExportedFunctionCompletedParameters,
ExportedFunctionInvokedParameters, ExportedFunctionParameters, FailedUpdateParameters,
GrowMemoryParameters, ImportedFunctionInvokedParameters, JumpParameters, LogParameters,
PendingUpdateParameters, PendingWorkerInvocationParameters, PluginInstallationDescription,
PublicOplogEntry, PublicRetryConfig, PublicUpdateDescription, PublicWorkerInvocation,
PublicWrappedFunctionType, ResourceParameters, SnapshotBasedUpdateParameters,
SuccessfulUpdateParameters, TimestampParameter,
};
use crate::model::{
AccountId, ComponentId, Empty, IdempotencyKey, PluginInstallationId, Timestamp, WorkerId,
};
use std::collections::{BTreeMap, BTreeSet};
use crate::model::{AccountId, ComponentId, Empty, IdempotencyKey, PluginInstallationId, Timestamp, WorkerId};
use uuid::Uuid;
use crate::model::public_oplog::{ChangeRetryPolicyParameters, CreateParameters, DescribeResourceParameters, EndRegionParameters, ErrorParameters, ExportedFunctionCompletedParameters, ExportedFunctionInvokedParameters, ExportedFunctionParameters, FailedUpdateParameters, GrowMemoryParameters, ImportedFunctionInvokedParameters, JumpParameters, LogParameters, PendingUpdateParameters, PendingWorkerInvocationParameters, PluginInstallationDescription, PublicOplogEntry, PublicRetryConfig, PublicUpdateDescription, PublicWorkerInvocation, PublicWrappedFunctionType, ResourceParameters, SnapshotBasedUpdateParameters, SuccessfulUpdateParameters, TimestampParameter};

#[cfg(feature = "poem")]
use poem_openapi::types::ToJSON;
use golem_wasm_ast::analysis::analysed_type::{field, list, r#enum, record, s16, str, u64};
use golem_wasm_rpc::{Value, ValueAndType};
use crate::model::oplog::{LogLevel, OplogIndex, WorkerResourceId};
use crate::model::regions::OplogRegion;
use golem_wasm_ast::analysis::analysed_type::{field, list, r#enum, record, s16, str, u64};
use golem_wasm_rpc::{Value, ValueAndType};
#[cfg(feature = "poem")]
use poem_openapi::types::ToJSON;

fn rounded_ts(ts: Timestamp) -> Timestamp {
Timestamp::from(ts.to_millis())
Expand Down
8 changes: 6 additions & 2 deletions golem-common/src/newtype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ macro_rules! newtype_uuid {
}

fn schema_ref() -> poem_openapi::registry::MetaSchemaRef {
poem_openapi::registry::MetaSchemaRef::Inline(Box::new(poem_openapi::registry::MetaSchema::new_with_format("string", "uuid")))
poem_openapi::registry::MetaSchemaRef::Inline(Box::new(
poem_openapi::registry::MetaSchema::new_with_format("string", "uuid"),
))
}

fn as_raw_value(&self) -> Option<&Self::RawValueType> {
Expand All @@ -125,7 +127,9 @@ macro_rules! newtype_uuid {

#[cfg(feature = "poem")]
impl poem_openapi::types::ParseFromJSON for $name {
fn parse_from_json(value: Option<serde_json::Value>) -> poem_openapi::types::ParseResult<Self> {
fn parse_from_json(
value: Option<serde_json::Value>,
) -> poem_openapi::types::ParseResult<Self> {
match value {
Some(serde_json::Value::String(s)) => Ok(Self(Uuid::from_str(&s)?)),
_ => Err(poem_openapi::types::ParseError::<$name>::custom(format!(
Expand Down
2 changes: 1 addition & 1 deletion golem-common/src/retries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ use std::pin::Pin;
use std::time::{Duration, Instant};
use tracing::{error, info, warn, Level};

use crate::model::RetryConfig;
use crate::metrics::external_calls::{
record_external_call_failure, record_external_call_retry, record_external_call_success,
};
use crate::model::RetryConfig;
use crate::retriable_error::IsRetriableError;

/// Returns the delay to be waited before the next retry attempt.
Expand Down
3 changes: 2 additions & 1 deletion golem-component-compilation-service/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ use std::net::{Ipv4Addr, SocketAddrV4};
use std::path::Path;
use uuid::Uuid;

use golem_common::config::{ConfigExample, ConfigLoader, HasConfigExamples, RetryConfig};
use golem_common::config::{ConfigExample, ConfigLoader, HasConfigExamples};
use golem_common::model::RetryConfig;
use golem_common::tracing::TracingConfig;
use golem_service_base::config::BlobStorageConfig;
use golem_worker_executor_base::services::golem_config::CompiledComponentServiceConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ use golem_api_grpc::proto::golem::component::v1::download_component_response;
use golem_api_grpc::proto::golem::component::v1::ComponentError;
use golem_api_grpc::proto::golem::component::v1::DownloadComponentRequest;
use golem_common::client::{GrpcClient, GrpcClientConfig};
use golem_common::config::RetryConfig;
use golem_common::metrics::external_calls::record_external_call_response_size_bytes;
use golem_common::model::ComponentId;
use golem_common::model::RetryConfig;
use golem_common::retries::with_retries;
use golem_worker_executor_base::grpc::authorised_grpc_request;
use golem_worker_executor_base::grpc::is_grpc_retriable;
Expand Down
2 changes: 1 addition & 1 deletion golem-component-service-base/src/service/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use bytes::Bytes;
use futures::TryStreamExt;
use golem_api_grpc::proto::golem::common::{ErrorBody, ErrorsBody};
use golem_api_grpc::proto::golem::component::v1::component_error;
use golem_common::config::RetryConfig;
use golem_common::model::component::ComponentOwner;
use golem_common::model::component_constraint::FunctionConstraintCollection;
use golem_common::model::component_metadata::{ComponentMetadata, ComponentProcessingError};
Expand All @@ -35,6 +34,7 @@ use golem_common::model::plugin::{
PluginInstallationUpdate, PluginScope, PluginTypeSpecificDefinition,
};
use golem_common::model::ComponentVersion;
use golem_common::model::RetryConfig;
use golem_common::model::{AccountId, PluginInstallationId};
use golem_common::model::{
ComponentFilePath, ComponentFilePermissions, ComponentId, ComponentType, InitialComponentFile,
Expand Down
7 changes: 5 additions & 2 deletions golem-rib/src/compiler/ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,9 @@ mod protobuf {
RibIR::PushLit(value) => {
Instruction::PushLit(golem_wasm_rpc::protobuf::TypeAnnotatedValue {
type_annotated_value: Some(
value.try_into().map_err(|errs: Vec<String>| errs.join(", "))?,
value
.try_into()
.map_err(|errs: Vec<String>| errs.join(", "))?,
),
})
}
Expand Down Expand Up @@ -578,7 +580,8 @@ mod protobuf {
RibIR::PushFlag(flag) => {
Instruction::PushFlag(golem_wasm_rpc::protobuf::TypeAnnotatedValue {
type_annotated_value: Some(
flag.try_into().map_err(|errs: Vec<String>| errs.join(", "))?,
flag.try_into()
.map_err(|errs: Vec<String>| errs.join(", "))?,
),
})
}
Expand Down
5 changes: 4 additions & 1 deletion golem-rib/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ use crate::call_type::CallType;
use crate::parser::block::block;
use crate::parser::type_name::TypeName;
use crate::type_registry::FunctionTypeRegistry;
use crate::{from_string, text, type_checker, type_inference, DynamicParsedFunctionName, InferredType, ParsedFunctionName, VariableId};
use crate::{
from_string, text, type_checker, type_inference, DynamicParsedFunctionName, InferredType,
ParsedFunctionName, VariableId,
};
use bigdecimal::{BigDecimal, FromPrimitive, ToPrimitive};
use combine::parser::char::spaces;
use combine::stream::position;
Expand Down
3 changes: 2 additions & 1 deletion golem-service-base/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use golem_common::config::{DbSqliteConfig, RetryConfig};
use golem_common::config::DbSqliteConfig;
use golem_common::model::RetryConfig;
use serde::{Deserialize, Serialize};
use std::{path::PathBuf, time::Duration};

Expand Down
4 changes: 2 additions & 2 deletions golem-shard-manager/src/healthcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::sync::Arc;

use async_trait::async_trait;

use golem_common::config::RetryConfig;
use golem_common::model::RetryConfig;
use golem_common::retries::with_retriable_errors;

use crate::error::HealthCheckError;
Expand Down Expand Up @@ -104,7 +104,7 @@ pub mod kubernetes {
use k8s_openapi::api::core::v1::{Pod, PodStatus};
use kube::{Api, Client};

use golem_common::config::RetryConfig;
use golem_common::model::RetryConfig;

use crate::healthcheck::{health_check_with_retries, HealthCheck, HealthCheckError};

Expand Down
5 changes: 2 additions & 3 deletions golem-shard-manager/src/shard_manager_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ use std::time::Duration;

use serde::{Deserialize, Serialize};

use golem_common::config::{
ConfigExample, ConfigLoader, HasConfigExamples, RedisConfig, RetryConfig,
};
use golem_common::config::{ConfigExample, ConfigLoader, HasConfigExamples, RedisConfig};
use golem_common::model::RetryConfig;
use golem_common::tracing::TracingConfig;

use crate::model::Empty;
Expand Down
2 changes: 1 addition & 1 deletion golem-worker-executor-base/src/durable_host/golem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub mod v11;

use anyhow::anyhow;
use async_trait::async_trait;
use golem_common::config::RetryConfig;
use golem_common::model::RetryConfig;
use std::time::Duration;
use tracing::debug;
use uuid::Uuid;
Expand Down
2 changes: 1 addition & 1 deletion golem-worker-executor-base/src/durable_host/golem/v11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ use crate::services::{HasOplogService, HasPlugins};
use crate::workerctx::WorkerCtx;
use anyhow::anyhow;
use async_trait::async_trait;
use golem_common::config::RetryConfig;
use golem_common::model::OwnedWorkerId;
use golem_common::model::RetryConfig;
use std::time::Duration;
use wasmtime::component::Resource;
use wasmtime_wasi::WasiView;
Expand Down
2 changes: 1 addition & 1 deletion golem-worker-executor-base/src/durable_host/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ pub use durability::*;
use futures::future::try_join_all;
use futures_util::TryFutureExt;
use futures_util::TryStreamExt;
use golem_common::config::RetryConfig;
use golem_common::model::component::ComponentOwner;
use golem_common::model::oplog::{
IndexedResourceKey, LogLevel, OplogEntry, OplogIndex, UpdateDescription, WorkerError,
WorkerResourceId, WrappedFunctionType,
};
use golem_common::model::plugin::{PluginOwner, PluginScope};
use golem_common::model::regions::{DeletedRegions, OplogRegion};
use golem_common::model::RetryConfig;
use golem_common::model::{exports, PluginInstallationId};
use golem_common::model::{
AccountId, ComponentFilePath, ComponentFilePermissions, ComponentFileSystemNode,
Expand Down
Loading

0 comments on commit 75202be

Please sign in to comment.