OpenSDN source code
qos_queue_ksync.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  * Copyright Contributors to the OpenSDN project
4  */
5 
6 #include <base/logging.h>
7 #include <ksync/ksync_index.h>
8 #include <ksync/ksync_entry.h>
9 #include <ksync/ksync_object.h>
10 #include <ksync/ksync_netlink.h>
11 #include <ksync/ksync_sock.h>
14 
16  const QosQueueKSyncEntry *qos_queue):
17  KSyncNetlinkDBEntry(), ksync_obj_(obj), id_(qos_queue->id()) {
18 }
19 
21  const QosQueue *qos_queue):
22  KSyncNetlinkDBEntry(), ksync_obj_(obj), id_(qos_queue->id()) {
23 }
24 
26  uint32_t id):
27  KSyncNetlinkDBEntry(), ksync_obj_(obj), id_(id) {
28 }
29 
31 }
32 
34  return ksync_obj_;
35 }
36 
37 bool QosQueueKSyncEntry::IsLess(const KSyncEntry &rhs) const {
38  const QosQueueKSyncEntry &entry = static_cast<const QosQueueKSyncEntry &>(rhs);
39  return id_ < entry.id_;
40 }
41 
42 std::string QosQueueKSyncEntry::ToString() const {
43 
44  std::stringstream s;
45  s << "Qos Queue id " << id_;
46  return s.str();
47 }
48 
50  return false;
51 }
52 
53 int QosQueueKSyncEntry::Encode(sandesh_op::type op, char *buf, int buf_len) {
54  return 0;
55 }
56 
57 int QosQueueKSyncEntry::AddMsg(char *buf, int buf_len) {
58  return Encode(sandesh_op::ADD, buf, buf_len);
59 }
60 
61 int QosQueueKSyncEntry::ChangeMsg(char *buf, int buf_len) {
62  return Encode(sandesh_op::ADD, buf, buf_len);
63 }
64 
65 int QosQueueKSyncEntry::DeleteMsg(char *buf, int buf_len) {
66  return Encode(sandesh_op::DEL, buf, buf_len);
67 }
68 
70  return NULL;
71 }
72 
74  KSyncDBObject("KSync Qos Queue Object"), ksync_(ksync) {
75 }
76 
78 
79 }
80 
83 }
84 
86 QosQueueKSyncObject::Alloc(const KSyncEntry *e, uint32_t index) {
87  const QosQueueKSyncEntry *entry = static_cast<const QosQueueKSyncEntry *>(e);
88  QosQueueKSyncEntry *new_entry = new QosQueueKSyncEntry(this, entry);
89  return static_cast<KSyncEntry *>(new_entry);
90 }
91 
93  const QosQueue *qos_queue = static_cast<const QosQueue *>(e);
94  QosQueueKSyncEntry *entry = new QosQueueKSyncEntry(this, qos_queue);
95  return static_cast<KSyncEntry *>(entry);
96 }
QosQueueTable * qos_queue_table() const
Definition: agent.h:565
void RegisterDb(DBTableBase *table)
Agent * agent() const
Definition: ksync_init.h:40
QosQueueKSyncEntry(QosQueueKSyncObject *obj, const QosQueueKSyncEntry *entry)
int Encode(sandesh_op::type op, char *buf, int buf_len)
virtual KSyncEntry * UnresolvedReference()
KSyncDBObject * GetObject() const
virtual ~QosQueueKSyncEntry()
virtual int ChangeMsg(char *buf, int buf_len)
KSyncDBObject * ksync_obj_
virtual bool Sync(DBEntry *e)
virtual bool IsLess(const KSyncEntry &rhs) const
virtual int DeleteMsg(char *buf, int buf_len)
virtual std::string ToString() const
virtual int AddMsg(char *buf, int buf_len)
virtual ~QosQueueKSyncObject()
virtual KSyncEntry * Alloc(const KSyncEntry *entry, uint32_t id)
QosQueueKSyncObject(KSync *ksync)
virtual KSyncEntry * DBToKSyncEntry(const DBEntry *e)
uint8_t type
Definition: load_balance.h:2