GraphLab: Distributed Graph-Parallel API
2.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
dc_send.hpp
1
/**
2
* Copyright (c) 2009 Carnegie Mellon University.
3
* All rights reserved.
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing,
12
* software distributed under the License is distributed on an "AS
13
* IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
* express or implied. See the License for the specific language
15
* governing permissions and limitations under the License.
16
*
17
* For more about this software visit:
18
*
19
* http://www.graphlab.ml.cmu.edu
20
*
21
*/
22
23
24
#ifndef DC_SEND_HPP
25
#define DC_SEND_HPP
26
#include <sys/types.h>
27
#include <sys/socket.h>
28
29
#include <iostream>
30
#include <graphlab/rpc/circular_iovec_buffer.hpp>
31
#include <graphlab/rpc/dc_internal_types.hpp>
32
#include <graphlab/rpc/dc_types.hpp>
33
namespace
graphlab {
34
namespace
dc_impl {
35
36
/**
37
\ingroup rpc
38
\internal
39
Base class of the data sending class.
40
This class forms the sending side of a "multiplexer"
41
send_data() will be called with a packet mask as well as a
42
character stream containing the contents of the packet.
43
The class should accumulate the data in an iovec structure
44
and relinquish it on get_outgoing_data()
45
*/
46
class
dc_send{
47
public
:
48
dc_send() { }
49
50
virtual
~dc_send() { }
51
52
/** Called to send data to the target. The caller transfers control of
53
the pointer. The caller MUST ensure that the data be prefixed
54
with sizeof(packet_hdr) extra bytes at the start for placement of the
55
packet header. This function must be reentrant. */
56
virtual
void
send_data(
procid_t
target,
57
unsigned
char
packet_type_mask,
58
char
* data,
size_t
len) = 0;
59
60
/** Sends the data but without transferring control of the pointer.
61
The function will make a copy of the data before sending it.
62
Unlike send_data, no padding is necessary. This function must be reentrant. */
63
virtual
void
copy_and_send_data(
procid_t
target,
64
unsigned
char
packet_type_mask,
65
char
* data,
size_t
len) = 0;
66
67
/**
68
Bytes sent must be incremented BEFORE the data is transmitted.
69
Packets marked CONTROL_PACKET should not be counted
70
*/
71
virtual
size_t
bytes_sent() = 0;
72
73
virtual
void
flush() = 0;
74
75
virtual
size_t
send_queue_length()
const
= 0;
76
77
virtual
size_t
set_option(std::string opt,
size_t
val) {
78
return
0;
79
}
80
81
/**
82
* Returns length if there is data, 0 otherwise. This function
83
* must be reentrant, but it is guaranteed that only one thread will
84
* call this function at anytime.
85
*/
86
virtual
size_t
get_outgoing_data(circular_iovec_buffer& outdata) = 0;
87
88
};
89
90
91
}
// namespace dc_impl
92
}
// namespace graphlab
93
#endif
94
graphlab
rpc
dc_send.hpp
Generated on Mon Jun 3 2013 05:00:04 for GraphLab: Distributed Graph-Parallel API by
1.8.1.1