Tracing GET request for Object

Asked by gaurav on 2012-12-07

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:
2012-12-12
Last query:
2012-12-12
Last reply:
2012-12-12
Samuel Merritt (torgomatic) said : #1

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

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 !

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.

gaurav (gauravmahajan2007) said : #4

Thanks Samuel Merritt, that solved my question.