https://opendal.apache.org/ logo
Box service support
# general
a
hi guys, I'm working on developing box service support, I have some doubts about definition of
root
. Hope someone could help me
I wonder if
root
in opendal has been set, such as
/root
, which corresponding folder should be chose in the service like Gdrive/Dropbox/Box
I guess it should be like "My Drive" in Google Drive like the following pic?

https://cdn.discordapp.com/attachments/1137003572916138015/1137004710730137712/image.png▾

or some certain folder in Google Drive we choose?
if the absolute path is
/root/path/to/123.pic
, i wonder what is the correct corresponding cloud file path should be in Google Drive Service, whose cloud root path is
/MyDrive
Specifically, i wonder the file whose path is
/root/path/to/123.pic
should be stored in
/MyDrive/root/path/to/123.pic
or
/MyDrive/path/to/123.pic
in Gdrive
y
google drive located files via its internal id. u can take a look at https://github.com/apache/incubator-opendal/pull/2184

https://cdn.discordapp.com/attachments/1137003572916138015/1137015873106890822/image.png▾

Box also seems to locate files by file id
a
thanks for your help, i know what you mean, it' same to Box service, my doubt is although service located files via its internal id, it still have files tree like this

https://cdn.discordapp.com/attachments/1137003572916138015/1137016635606192179/image.png▾

y
so there may need a file path to file id mapping
a
i have read the code of gdrive, which impress me, i found gdrive got the root folder id, and i cann't find in google api doc

https://cdn.discordapp.com/attachments/1137003572916138015/1137017345425031218/image.png▾

like this
a
i wonder the meaning of get request
"https://www.googleapis.com/drive/v3/files/root
it doubts me
i wonder the mapping rule of openDAL like you say
so there may need a file path to file id mapping
y
The
root
here can be understood as an file id alias of the root directory in gdrive, and this root directory also has its own file id. this alias wasn't specify in gdrive docs, I found it by chance
there is another way to get
root
file id, wait a sencond
a
could you like to explain the
root
parameter set in openDAL Gdrive means what ?
x
Oh, let's get rid of gdrive from this disscusion first.
root is simple: it's the root folder for all opendal operations.
For example, if root is
/abc
, op.read("def") will become
/abd/def
to underlying storage.
And some services could have their own namespace concepts like
bucket
,
drive
. It's another config that users need to pass in.
For example, gdrive (which doesn't support shared drive yet) will use personal drive by default.
a
i wonder the root is mounted in cloud storage or local disk
x
There is no idea of
mount
.
a
maybe i got you mean, it seems we don't care about the file tree, we only care accessing capability of the file in specifical cloud storage path ?
x
Maybe we can talk about the box API directly?
Which part make you confused?
Maybe about this? > The root folder of a Box account is always represented by the ID 0.
a
sorry for that, it's my misunderstanding😢 😵‍💫
i found cache in path, and got some misunderstanding of service
x
Yes, box and gdrive services using
fileid
instead of path for file, it's more complex than other services.
a
yep, 😵‍💫 sorry for my confusion, i got confused with the meaning of root
now, i have no problems, thanks for your kind help
y
it means to
set current dir
for a service
x
Also thanks @young_flash for gdrive example.
a
yep, I am grateful for the help both of you provided
🥹 😿
x
Don't worry and don't push too much pressure on self. Take it easy and enjoy the journey.
OpenDAL is not a business project (alought it's used by many company), and we are all contributors instead of employees.
No one pay for you and no one can fire you 🥰
s
😅The file id in Google Drive really bothers me.
In fact, there is somewhere in doc to tell this.
a
hi guys, i have finished some functions, and i got a problem now. i have no idea about building this box' upload api's
POST
request( https://developer.box.com/reference/post-files-content#query-parameters) by
http::request
in rust, hope someone could give me some guidance

https://cdn.discordapp.com/attachments/1137003572916138015/1137070479191064667/image.png▾

s
You may need to enable the multipart flag of reqwest.
😅And we do not have a send method for multipart/form-data on http_client. You may create one.
a
it seems complex.......
s
For attributes, write a json and then serialize it. Add it into a form and then file. Take a look at serde_json::json.
a
i check the code of http_client
s
Go to bed early, don't stay up late.🥹
a
lol 🥲
let me wait for more info tomorrow , Sweet Dream!
s
😄Wow, you can have a try. If it exists, I think there must be somewhere it has been used.
a
hi @Xuanwo , I still got trouble in building and sending the
multipart/form-data
POST request, i read the code of implement of multipart-form in http_client and can't find a usage as a reference, if you can give me some guidance, i will be much appreciated.
i check the code which seems related in gcs/core.rs, but i can't understand it clearly🥹

https://cdn.discordapp.com/attachments/1137003572916138015/1137349167065350165/image.png▾

i found the POST request looks like above

https://cdn.discordapp.com/attachments/1137003572916138015/1137362913888309388/image.png▾

seems it's possible to build the request with http:: requst
s
Maybe you could learn some knowledge about formdata firstly?
x
I suggest to skip this part and keep moving on.
We can make reading works first and than come back to address the write later.
I believe it will feel much better than been blocked at every place.
a
i agree with you, and i have write a sample for this api, i wonder if you can help me review it,i have finished some learning work about it
x
Yes, of course!
a

https://cdn.discordapp.com/attachments/1137003572916138015/1137404664049062009/image.png▾

x
Oh, not in this way
a
i tried to build the post body message manually
x
Please submit as a draft pr so all our committers can take part in.
a
my fault, let's talk in draft pr
3 Views