forked from facebookarchive/scribe
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNetworkStore.h
More file actions
89 lines (78 loc) · 2.44 KB
/
NetworkStore.h
File metadata and controls
89 lines (78 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Copyright (c) 2007-2008 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// See accompanying file LICENSE or visit the Scribe site at:
// http://developers.facebook.com/scribe/
//
// @author Bobby Johnson
// @author James Wang
// @author Jason Sobel
// @author Alex Moskalyuk
// @author Avinash Lakshman
// @author Anthony Giardullo
// @author Jan Oravec
// @author John Song
#ifndef SCRIBE_NETWORK_STORE_H
#define SCRIBE_NETWORK_STORE_H
#include "Common.h"
#include "Conf.h"
#include "ConnPool.h"
#include "NetworkDynamicConfig.h"
#include "Store.h"
namespace scribe {
/*
* This store sends messages to another scribe server.
* This class is really just an adapter to the global
* connection pool g_connPool.
*/
class NetworkStore : public Store {
public:
NetworkStore(StoreQueue* storeq,
const string& category,
bool multiCategory);
~NetworkStore();
StorePtr copy(const string &category);
bool handleMessages(LogEntryVectorPtr messages);
bool open();
bool isOpen();
void configure(StoreConfPtr configuration, StoreConfPtr parent);
void close();
void flush();
void periodicCheck();
protected:
void incrementSentCounter(const string& host, unsigned long port,
unsigned long numMsg, unsigned long numBytes);
// configuration
bool useConnPool_;
bool serviceBased_;
long timeout_;
string remoteHost_;
unsigned long remotePort_; // long because it works with config code
string serviceName_;
string serviceOptions_;
ServerVector servers_;
unsigned long serviceCacheTimeout_;
NetworkDynamicConfigMod* configMod_;
// state
bool opened_;
shared_ptr<ScribeConn> unpooledConn_; // null if useConnPool
time_t lastServiceCheck_;
private:
// disallow copy, assignment, and empty construction
NetworkStore();
NetworkStore(NetworkStore& rhs);
NetworkStore& operator=(NetworkStore& rhs);
};
} //! namespace scribe
#endif //! SCRIBE_NETWORK_STORE_H