Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save rados object #2

Closed
jrse opened this issue May 8, 2017 · 4 comments
Closed

Save rados object #2

jrse opened this issue May 8, 2017 · 4 comments
Assignees

Comments

@jrse
Copy link
Contributor

jrse commented May 8, 2017

No description provided.

@jrse
Copy link
Contributor Author

jrse commented May 10, 2017

  • implement simple object storage for email object | rfc2822
  • find point in code to add this functionality (rbos-file.c, dbox-file.c)

@jrse
Copy link
Contributor Author

jrse commented May 10, 2017

@jrse
Copy link
Contributor Author

jrse commented May 17, 2017

rbox_save_continue function can be used to read the mail body from instream and write it byte wise to rados.

-> however in our tests, rbox_save_continue is called twice.

@jrse
Copy link
Contributor Author

jrse commented May 17, 2017

160 off_t stream_mail_to_rados(rados_ioctx_t* ceph_io, char* guid, struct istream *instream)
161 {
162 uoff_t start_offset;
163 struct const_iovec iov;
164 const unsigned char *data;
165 ssize_t ret;
166 int offset = 0;
167 start_offset = instream->v_offset;
168 do{
169 (void)i_stream_read_data(instream, &data, &iov.iov_len,0);
170 if(iov.iov_len ==0){
171 /*all sent /
172 if(instream->stream_errno !=0){
173 return -1;
174 }
175 break;
176 }
177
178 iov.iov_base = data;
179
180 int err = rados_write(ceph_io,guid,iov.iov_base,iov.iov_len, offset);
181 if(err <0){
182 i_debug("cannot write to pool %lu",ceph_io);
183 }
184 else{
185 i_debug("wrote to pool");
186 offset +=iov.iov_len;
187 }
188 /
im done ?
/
189 i_stream_skip(instream,0);
190
191 }while((size_t)ret == iov.iov_len);
192
193 return (off_t)(instream->v_offset - start_offset);
194 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants