@@ -68,16 +68,6 @@ impl Metastore for ObjectStoreMetastore {
6868 unimplemented ! ( )
6969 }
7070
71- /// Might implement later
72- async fn list_objects ( & self ) -> Result < ( ) , MetastoreError > {
73- unimplemented ! ( )
74- }
75-
76- /// Might implement later
77- async fn get_object ( & self ) -> Result < ( ) , MetastoreError > {
78- unimplemented ! ( )
79- }
80-
8171 /// Fetch mutiple .json objects
8272 async fn get_objects ( & self , parent_path : & str ) -> Result < Vec < Bytes > , MetastoreError > {
8373 Ok ( self
@@ -105,7 +95,12 @@ impl Metastore for ObjectStoreMetastore {
10595
10696 /// This function puts an alert in the object store at the given path
10797 async fn put_alert ( & self , obj : & dyn MetastoreObject ) -> Result < ( ) , MetastoreError > {
108- let path = alert_json_path ( Ulid :: from_string ( & obj. get_object_id ( ) ) . unwrap ( ) ) ;
98+ let id = Ulid :: from_string ( & obj. get_object_id ( ) ) . map_err ( |e| MetastoreError :: Error {
99+ status_code : StatusCode :: BAD_REQUEST ,
100+ message : e. to_string ( ) ,
101+ flow : "put_alert" . into ( ) ,
102+ } ) ?;
103+ let path = alert_json_path ( id) ;
109104
110105 Ok ( self . storage . put_object ( & path, to_bytes ( obj) ) . await ?)
111106 }
@@ -536,7 +531,10 @@ impl Metastore for ObjectStoreMetastore {
536531 . await ?
537532 . iter ( )
538533 // we should be able to unwrap as we know the data is valid schema
539- . map ( |byte_obj| serde_json:: from_slice ( byte_obj) . expect ( "data is valid json" ) )
534+ . map ( |byte_obj| {
535+ serde_json:: from_slice ( byte_obj)
536+ . unwrap_or_else ( |_| panic ! ( "got an invalid schema for stream: {stream_name}" ) )
537+ } )
540538 . collect ( ) )
541539 }
542540
@@ -661,6 +659,7 @@ impl Metastore for ObjectStoreMetastore {
661659 . await
662660 . map_err ( MetastoreError :: ObjectStorageError )
663661 } else {
662+ // not local-disk, object storage
664663 let mut result_file_list = HashSet :: new ( ) ;
665664 let resp = self . storage . list_with_delimiter ( None ) . await ?;
666665
@@ -669,7 +668,12 @@ impl Metastore for ObjectStoreMetastore {
669668 . iter ( )
670669 . flat_map ( |path| path. parts ( ) )
671670 . map ( |name| name. as_ref ( ) . to_string ( ) )
672- . filter ( |name| name != PARSEABLE_ROOT_DIRECTORY && name != USERS_ROOT_DIR )
671+ . filter ( |name| {
672+ name != PARSEABLE_ROOT_DIRECTORY
673+ && name != USERS_ROOT_DIR
674+ && name != SETTINGS_ROOT_DIRECTORY
675+ && name != ALERTS_ROOT_DIRECTORY
676+ } )
673677 . collect :: < Vec < _ > > ( ) ;
674678
675679 for stream in streams {
0 commit comments