Tracing GET request for Object

Asked by gaurav

Hi,

I am trying to understand object server code.
I understood PUT request completely. It uses os.write to write the content of objects.

I was not able to understand How GET Request sends the object data.
Where the content of object gets read from disk? Can anyone point to the particular function.?

Any help is appreciated.
Thanks!

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Object Storage (swift) Edit question
Assignee:
No assignee Edit question
Solved by:
Samuel Merritt
Solved:
Last query:
Last reply:
Revision history for this message
Samuel Merritt (torgomatic) said :
#1

Take a look at swift.obj.server.DiskFile.__iter__().

Revision history for this message
gaurav (gauravmahajan2007) said :
#2

Thanks Samuel !

I have some more questions.

1. Where does this iterator gets called?

2. Is swift.obj.server.DiskFile.__iter__() is only way by which swift read contents of an object?

3. Is it that only object server uses this method and Auditor use some other way?

Thanks !

Revision history for this message
Best Samuel Merritt (torgomatic) said :
#3

It's a little complicated how it gets called, but essentially the object server returns a swob.Response(app_iter=X), where X is a DiskFile. Then, swob.Response.__call__ gets invoked by WSGI, and that returns an iterator that ultimately wraps the DiskFile, and that's how the file's bytes get up to WSGI and hence onto the wire.

As for the auditor, it's fairly easy to read; look through and see if "DiskFile" appears in the code anywhere, and that'll answer your question.

Revision history for this message
gaurav (gauravmahajan2007) said :
#4

Thanks Samuel Merritt, that solved my question.