ScaleOut C++ Native Client API
5.1
Main Page
Classes
Files
File List
All
Classes
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Pages
soss_events.h
1
/*
2
Copyright (c) 2013 by ScaleOut Software, Inc.
3
4
Licensed under the Apache License, Version 2.0 (the "License");
5
you may not use this file except in compliance with the License.
6
You may obtain a copy of the License at
7
8
http://www.apache.org/licenses/LICENSE-2.0
9
10
Unless required by applicable law or agreed to in writing, software
11
distributed under the License is distributed on an "AS IS" BASIS,
12
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
See the License for the specific language governing permissions and
14
limitations under the License.
15
*/
16
17
#pragma once
18
19
#include <stdint.h>
20
#include <boost/function.hpp>
21
22
#include "soss_client/soss_key.h"
23
#include "soss_client/named_cache.h"
24
#include "soss_svccli.h"
25
26
namespace
sosscli {
27
30
class
SossEvents
31
{
32
public
:
33
36
enum
EventCode
37
{
39
ObjectTimeout
= SOSSLIB_EVT_TIMEOUT,
40
43
LowMemory
= SOSSLIB_EVT_LOW_MEM,
44
46
Dependency
= SOSSLIB_EVT_DEPEND,
47
49
LoadFromBackingStore
= SOSSLIB_EVT_LOAD,
50
52
StoreInBackingStore
= SOSSLIB_EVT_STORE,
53
55
EraseFromBackingStore
= SOSSLIB_EVT_ERASE,
56
};
57
60
enum
ObjectDisposition
61
{
63
Save
= SOSSLIB_EVTRET_SAVE,
64
66
Remove
= SOSSLIB_EVTRET_REMOVE,
67
70
NotHandled
= SOSSLIB_EVTRET_NOT_HANDLED,
71
};
72
74
class
EventDetails
{
75
public
:
77
EventDetails
(
SossKey
key
,
EventCode
event_code
);
78
80
SossKey
key
()
const
{
return
key_; }
81
83
EventCode
event_code
()
const
{
return
event_code_; }
84
85
private
:
86
SossKey
key_;
87
EventCode
event_code_;
88
};
89
111
typedef
boost::function<ObjectDisposition(EventDetails const & details)>
Callback
;
112
121
typedef
uint32_t
CallbackHandle
;
122
140
static
CallbackHandle
register_callback
(
NamedCache
const
& cache,
Callback
const
& callback);
141
152
static
CallbackHandle
register_callback
(uint32_t app_id,
Callback
const
& callback);
153
162
static
void
clear_callbacks
(
NamedCache
const
& cache);
163
168
static
void
clear_callbacks
(uint32_t app_id);
169
175
static
void
erase_callback
(
NamedCache
const
& cache,
CallbackHandle
callback_handle);
176
182
static
void
erase_callback
(uint32_t app_id,
CallbackHandle
callback_handle);
183
184
private
:
185
class
Impl;
186
static
Impl * impl_p_;
187
};
188
189
}
190
© 2014
ScaleOut Software, Inc.