Re: [ceph-users] librados: how to get notified when a certain object is created

2016-02-24 Thread Sorin Manolache

On 2016-02-23 20:48, Gregory Farnum wrote:

On Saturday, February 20, 2016, Sorin Manolache > wrote:

Hello,

I can set a watch on an object in librados. Does this object have to
exist already at the moment I'm setting the watch on it? What
happens if the object does not exist? Is my watcher valid? Will I
get notified when someone else creates the missing object that I'm
watching and sends a notification?


I believe a watch implicitly creates the object, but you could run it on
a non-existent object and check. ;) but...


I hadn't tried that when I asked the question as I was still down at the 
learning curve of librados. I've tried it in the meantime and 
rados_watch returns ENOENT if the object does not exist.


Sorin
___
ceph-users mailing list
ceph-users@lists.ceph.com
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com


Re: [ceph-users] librados: how to get notified when a certain object is created

2016-02-23 Thread Brad Hubbard

- Original Message -
> From: "Sorin Manolache" 
> To: ceph-users@lists.ceph.com
> Sent: Sunday, 21 February, 2016 8:20:13 AM
> Subject: [ceph-users] librados: how to get notified when a certain object is  
> created
> 
> Hello,
> 
> I can set a watch on an object in librados. Does this object have to
> exist already at the moment I'm setting the watch on it? What happens if
> the object does not exist? Is my watcher valid? Will I get notified when
> someone else creates the missing object that I'm watching and sends a
> notification?
> 
> If the watch is not valid if the object has not yet been created then
> how can I get notified when the object is created? (I can imagine a
> work-around: there's an additional object, a kind of object registry
> object (the equivalent of a directory in a file system), that contains
> the list of created objects. I'm watching for modifications of the
> object registry object. Whenever a new object is created, the agent that
> creates the object also updates the object registry object.)

Could an object class be the right solution here?

https://github.com/ceph/ceph/blob/master/src/cls/hello/cls_hello.cc#L78

Cheers,
Brad

> 
> Thank you,
> Sorin
> ___
> ceph-users mailing list
> ceph-users@lists.ceph.com
> http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com
> 
___
ceph-users mailing list
ceph-users@lists.ceph.com
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com


Re: [ceph-users] librados: how to get notified when a certain object is created

2016-02-23 Thread Gregory Farnum
On Saturday, February 20, 2016, Sorin Manolache  wrote:

> Hello,
>
> I can set a watch on an object in librados. Does this object have to exist
> already at the moment I'm setting the watch on it? What happens if the
> object does not exist? Is my watcher valid? Will I get notified when
> someone else creates the missing object that I'm watching and sends a
> notification?


I believe a watch implicitly creates the object, but you could run it on a
non-existent object and check. ;) but...


>
> If the watch is not valid if the object has not yet been created then how
> can I get notified when the object is created? (I can imagine a
> work-around: there's an additional object, a kind of object registry object
> (the equivalent of a directory in a file system), that contains the list of
> created objects. I'm watching for modifications of the object registry
> object. Whenever a new object is created, the agent that creates the object
> also updates the object registry object.)


This is probably a better idea. Watches have a bit of overhead and while
you can have a few per client without much trouble; if you're trying to
watch a whole bunch of potential objects you probably want a stronger side
channel communications system anyway, so using a set of communication
objects and pushing the relevant data through them is likely to work better.
-Greg



>
> Thank you,
> Sorin
> ___
> ceph-users mailing list
> ceph-users@lists.ceph.com
> http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com
>
___
ceph-users mailing list
ceph-users@lists.ceph.com
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com


[ceph-users] librados: how to get notified when a certain object is created

2016-02-20 Thread Sorin Manolache

Hello,

I can set a watch on an object in librados. Does this object have to 
exist already at the moment I'm setting the watch on it? What happens if 
the object does not exist? Is my watcher valid? Will I get notified when 
someone else creates the missing object that I'm watching and sends a 
notification?


If the watch is not valid if the object has not yet been created then 
how can I get notified when the object is created? (I can imagine a 
work-around: there's an additional object, a kind of object registry 
object (the equivalent of a directory in a file system), that contains 
the list of created objects. I'm watching for modifications of the 
object registry object. Whenever a new object is created, the agent that 
creates the object also updates the object registry object.)


Thank you,
Sorin
___
ceph-users mailing list
ceph-users@lists.ceph.com
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com