Browse Source

Split traits from the common crate

Shamil Gadelshin 5 years ago
parent
commit
3133c240f5

+ 0 - 20
runtime-modules/common/src/traits.rs

@@ -1,5 +1,4 @@
 use crate::roles::actors;
-use crate::storage::{data_directory, data_object_storage_registry, data_object_type_registry};
 use system;
 
 // Roles
@@ -25,22 +24,3 @@ impl<T: system::Trait> Roles<T> for () {
         Err("not implemented")
     }
 }
-
-// Storage
-pub trait IsActiveDataObjectType<T: data_object_type_registry::Trait> {
-    fn is_active_data_object_type(_which: &T::DataObjectTypeId) -> bool;
-}
-
-pub trait ContentIdExists<T: data_directory::Trait> {
-    fn has_content(_which: &T::ContentId) -> bool;
-
-    fn get_data_object(
-        _which: &T::ContentId,
-    ) -> Result<data_directory::DataObject<T>, &'static str>;
-}
-
-pub trait ContentHasStorage<T: data_object_storage_registry::Trait> {
-    fn has_storage_provider(_which: &T::ContentId) -> bool;
-
-    fn is_ready_at_storage_provider(_which: &T::ContentId, _provider: &T::AccountId) -> bool;
-}

+ 1 - 0
runtime-modules/storage/src/lib.rs

@@ -4,5 +4,6 @@
 pub mod data_directory;
 pub mod data_object_storage_registry;
 pub mod data_object_type_registry;
+pub mod traits;
 
 mod mock;

+ 21 - 0
runtime-modules/storage/src/traits.rs

@@ -0,0 +1,21 @@
+use crate::storage::{data_directory, data_object_storage_registry, data_object_type_registry};
+use system;
+
+// Storage
+pub trait IsActiveDataObjectType<T: data_object_type_registry::Trait> {
+    fn is_active_data_object_type(_which: &T::DataObjectTypeId) -> bool;
+}
+
+pub trait ContentIdExists<T: data_directory::Trait> {
+    fn has_content(_which: &T::ContentId) -> bool;
+
+    fn get_data_object(
+        _which: &T::ContentId,
+    ) -> Result<data_directory::DataObject<T>, &'static str>;
+}
+
+pub trait ContentHasStorage<T: data_object_storage_registry::Trait> {
+    fn has_storage_provider(_which: &T::ContentId) -> bool;
+
+    fn is_ready_at_storage_provider(_which: &T::ContentId, _provider: &T::AccountId) -> bool;
+}