@@ -10,6 +10,7 @@ use ceramic_http_client::ceramic_event::{DidDocument, JwkSigner};
1010use ceramic_http_client:: CeramicHttpClient ;
1111
1212use models:: RandomModelInstance ;
13+ use serde:: { Deserialize , Serialize } ;
1314
1415use crate :: simulate:: Scenario ;
1516
@@ -36,7 +37,8 @@ impl Credentials {
3637 }
3738}
3839
39- #[ derive( Debug , Clone , PartialEq , Eq ) ]
40+ #[ derive( Debug , Clone , PartialEq , Eq , serde:: Deserialize , serde:: Serialize ) ]
41+ #[ serde( rename_all = "camelCase" ) ]
4042pub enum DidType {
4143 /// One DID for all users
4244 Shared ,
@@ -46,7 +48,8 @@ pub enum DidType {
4648 //UserCacao,
4749}
4850
49- #[ derive( Debug , Clone , PartialEq , Eq ) ]
51+ #[ derive( Debug , Clone , PartialEq , Eq , serde:: Deserialize , serde:: Serialize ) ]
52+ #[ serde( rename_all = "camelCase" ) ]
5053pub enum ReuseType {
5154 /// Create a new model or model instance document for each user
5255 PerUser ,
@@ -56,7 +59,8 @@ pub enum ReuseType {
5659 Shared ,
5760}
5861
59- #[ derive( Debug , Clone ) ]
62+ #[ derive( Serialize , Deserialize , Debug , PartialEq , Clone ) ]
63+ #[ serde( rename_all = "camelCase" ) ]
6064pub struct CeramicScenarioParameters {
6165 pub did_type : DidType ,
6266 /// Whether models should be shared or independent
@@ -68,43 +72,45 @@ pub struct CeramicScenarioParameters {
6872
6973impl From < Scenario > for CeramicScenarioParameters {
7074 fn from ( value : Scenario ) -> Self {
75+ // did_type: DidType::UserDidKey and model_instance_reuse: ReuseType::Shared is an invalid combination
76+ // as we'll try to update documents owned by another controller and just log lots of errors
7177 match value {
7278 Scenario :: CeramicSimple => Self {
7379 did_type : DidType :: Shared ,
7480 model_reuse : ReuseType :: PerUser ,
7581 model_instance_reuse : ReuseType :: PerUser ,
7682 number_of_documents : 1 ,
7783 } ,
78- Scenario :: CeramicUserSimple => Self {
84+ Scenario :: CeramicModelReuse => Self {
7985 did_type : DidType :: UserDidKey ,
80- model_reuse : ReuseType :: PerUser ,
86+ model_reuse : ReuseType :: Shared ,
8187 model_instance_reuse : ReuseType :: PerUser ,
8288 number_of_documents : 1 ,
8389 } ,
8490 Scenario :: CeramicWriteOnly => Self {
8591 did_type : DidType :: UserDidKey ,
86- model_reuse : ReuseType :: PerUser ,
92+ model_reuse : ReuseType :: Shared ,
8793 model_instance_reuse : ReuseType :: PerUser ,
8894 number_of_documents : 1 ,
8995 } ,
9096 Scenario :: CeramicNewStreams => Self {
9197 did_type : DidType :: UserDidKey ,
9298 model_reuse : ReuseType :: PerUser ,
9399 model_instance_reuse : ReuseType :: PerUser ,
94- number_of_documents : 1 ,
100+ number_of_documents : 0 ,
101+ } ,
102+ Scenario :: CeramicNewStreamsBenchmark => Self {
103+ did_type : DidType :: UserDidKey ,
104+ model_reuse : ReuseType :: Shared ,
105+ model_instance_reuse : ReuseType :: PerUser ,
106+ number_of_documents : 0 ,
95107 } ,
96108 Scenario :: CeramicQuery => Self {
97109 did_type : DidType :: Shared ,
98110 model_reuse : ReuseType :: PerUser ,
99111 model_instance_reuse : ReuseType :: PerUser ,
100112 number_of_documents : 3 ,
101113 } ,
102- Scenario :: CeramicModelReuse => Self {
103- did_type : DidType :: UserDidKey ,
104- model_reuse : ReuseType :: Shared ,
105- model_instance_reuse : ReuseType :: Shared ,
106- number_of_documents : 1 ,
107- } ,
108114 Scenario :: IpfsRpc | Scenario :: ReconEventSync | Scenario :: ReconEventKeySync => {
109115 panic ! ( "Not supported for non ceramic scenarios" )
110116 }
0 commit comments