@@ -9,7 +9,6 @@ use super::{
99 object:: Object ,
1010} ;
1111
12- use chrono:: Utc ;
1312use faster_hex:: hex_string;
1413use futures:: {
1514 channel:: mpsc:: unbounded,
@@ -18,7 +17,7 @@ use futures::{
1817 stream:: { StreamExt , TryStreamExt } ,
1918} ;
2019use md5:: { Digest , Md5 } ;
21- use s3_server:: dto:: { Bucket , ByteStream } ;
20+ use s3_server:: dto:: ByteStream ;
2221use sled:: { Db , Transactional } ;
2322use std:: {
2423 convert:: { TryFrom , TryInto } ,
@@ -287,10 +286,7 @@ impl CasFS {
287286 pub fn create_bucket ( & self , bucket_name : String ) -> Result < ( ) , MetaError > {
288287 let bucket_meta = self . get_tree ( BUCKET_META_TREE ) ?;
289288
290- let bm = Vec :: from ( & BucketMeta :: new (
291- Utc :: now ( ) . timestamp ( ) ,
292- bucket_name. clone ( ) ,
293- ) ) ;
289+ let bm = BucketMeta :: new ( bucket_name. clone ( ) ) . to_vec ( ) ;
294290
295291 match bucket_meta. insert ( bucket_name, bm) {
296292 Ok ( _) => Ok ( ( ) ) ,
@@ -349,7 +345,7 @@ impl CasFS {
349345 }
350346
351347 /// Get a list of all buckets in the system.
352- pub fn get_buckets ( & self ) -> Result < Vec < Bucket > , MetaError > {
348+ pub fn list_buckets ( & self ) -> Result < Vec < BucketMeta > , MetaError > {
353349 let bucket_tree = match self . sled_bucket_meta_tree ( ) {
354350 Ok ( t) => t,
355351 Err ( e) => return Err ( MetaError :: UnknownError ( e. to_string ( ) ) ) ,
@@ -364,7 +360,7 @@ impl CasFS {
364360 } ;
365361 // unwrap here is fine as it means the db is corrupt
366362 let bucket_meta = BucketMeta :: try_from ( & * value) . expect ( "Corrupted bucket metadata" ) ;
367- Some ( bucket_meta. into ( ) )
363+ Some ( bucket_meta)
368364 } )
369365 . collect ( ) ;
370366 Ok ( buckets)
0 commit comments