Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
HyperLoom
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ADAS
HyperLoom
Commits
473e3067
Commit
473e3067
authored
Jul 22, 2016
by
Stanislav Bohm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: length and data size in messages
parent
09978eea
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
447 additions
and
108 deletions
+447
-108
src/client/client.py
src/client/client.py
+2
-2
src/client/loomcomm_pb2.py
src/client/loomcomm_pb2.py
+52
-24
src/libloom/data.cpp
src/libloom/data.cpp
+10
-1
src/libloom/data.h
src/libloom/data.h
+1
-1
src/libloom/data/array.cpp
src/libloom/data/array.cpp
+1
-7
src/libloom/data/array.h
src/libloom/data/array.h
+0
-1
src/libloom/data/rawdata.cpp
src/libloom/data/rawdata.cpp
+1
-7
src/libloom/data/rawdata.h
src/libloom/data/rawdata.h
+1
-2
src/libloom/interconnect.h
src/libloom/interconnect.h
+1
-1
src/libloom/loomcomm.pb.cc
src/libloom/loomcomm.pb.cc
+172
-24
src/libloom/loomcomm.pb.h
src/libloom/loomcomm.pb.h
+154
-18
src/libloom/taskinstance.cpp
src/libloom/taskinstance.cpp
+3
-6
src/libloom/taskinstance.h
src/libloom/taskinstance.h
+0
-1
src/libloom/worker.cpp
src/libloom/worker.cpp
+5
-3
src/libloom/worker.h
src/libloom/worker.h
+3
-3
src/proto/loomcomm.proto
src/proto/loomcomm.proto
+9
-3
src/server/tasknode.h
src/server/tasknode.h
+10
-2
src/server/workerconn.cpp
src/server/workerconn.cpp
+1
-1
tests/client/array_test.py
tests/client/array_test.py
+4
-1
tests/client/fail_test.py
tests/client/fail_test.py
+17
-0
No files found.
src/client/client.py
View file @
473e3067
...
...
@@ -88,9 +88,9 @@ class Client(object):
msg_data
.
ParseFromString
(
self
.
connection
.
receive_message
())
type_id
=
msg_data
.
type_id
if
type_id
==
300
:
# Data
return
self
.
connection
.
read_data
(
msg_data
.
arg0_u64
)
return
self
.
connection
.
read_data
(
msg_data
.
size
)
if
type_id
==
400
:
# Array
return
[
self
.
_receive_data
()
for
i
in
xrange
(
msg_data
.
arg0_u64
)]
return
[
self
.
_receive_data
()
for
i
in
xrange
(
msg_data
.
length
)]
assert
0
def
_send_message
(
self
,
message
):
...
...
src/client/loomcomm_pb2.py
View file @
473e3067
...
...
@@ -18,7 +18,7 @@ _sym_db = _symbol_database.Default()
DESCRIPTOR
=
_descriptor
.
FileDescriptor
(
name
=
'loomcomm.proto'
,
package
=
'loomcomm'
,
serialized_pb
=
_b
(
'
\n\x0e
loomcomm.proto
\x12\x08
loomcomm
\"\xbb\x01\n\x08
Register
\x12\x18\n\x10
protocol_version
\x18\x01
\x02
(
\x05\x12
%
\n\x04
type
\x18\x02
\x02
(
\x0e\x32\x17
.loomcomm.Register.Type
\x12\x0c\n\x04
port
\x18\x03
\x01
(
\x05\x12\x12\n\n
task_types
\x18\x04
\x03
(
\t\x12\x0c\n\x04\x63
pus
\x18\x05
\x01
(
\x05\x12\x0c\n\x04
info
\x18\n
\x01
(
\x08\"
0
\n\x04
Type
\x12\x13\n\x0f
REGISTER_WORKER
\x10\x01\x12\x13\n\x0f
REGISTER_CLIENT
\x10\x02\"
&
\n\r
ServerMessage
\"\x15\n\x04
Type
\x12\r\n\t
START_JOB
\x10\x01\"\xf1\x01\n\r
WorkerCommand
\x12
*
\n\x04
type
\x18\x01
\x02
(
\x0e\x32\x1c
.loomcomm.WorkerCommand.Type
\x12\n\n\x02
id
\x18\x02
\x01
(
\x05\x12\x11\n\t
task_type
\x18\x03
\x01
(
\x05\x12\x13\n\x0b
task_config
\x18\x04
\x01
(
\t\x12\x13\n\x0b
task_inputs
\x18\x05
\x03
(
\x05\x12\x0f\n\x07\x61\x64\x64
ress
\x18\n
\x01
(
\t\x12\x11\n\t
with_size
\x18\x0b
\x01
(
\x08\x12\x0f\n\x07
symbols
\x18\x64
\x03
(
\t\"
6
\n\x04
Type
\x12\x08\n\x04
TASK
\x10\x01\x12\x08\n\x04
SEND
\x10\x02\x12\n\n\x06
REMOVE
\x10\x03\x12\x0e\n\n
DICTIONARY
\x10\x04\"
|
\n\x0e
WorkerResponse
\x12
+
\n\x04
type
\x18\x01
\x02
(
\x0e\x32\x1d
.loomcomm.WorkerResponse.Type
\x12\n\n\x02
id
\x18\x02
\x02
(
\x05\x12\x11\n\t
error_msg
\x18\x03
\x01
(
\t\"\x1e\n\x04
Type
\x12\n\n\x06\x46
INISH
\x10\x01\x12\n\n\x06\x46\x41
ILED
\x10\x02\"\x18\n\x08\x41
nnounce
\x12\x0c\n\x04
port
\x18\x01
\x02
(
\x05\"
-
\n\x0c\x44\x61
taPrologue
\x12\n\n\x02
id
\x18\x01
\x02
(
\x05\x12\x11\n\t
data_size
\x18\x03
\x01
(
\x04\"
;
\n\x04\x44\x61
ta
\x12\x0f\n\x07
type_id
\x18\x01
\x02
(
\x05\x12\x10\n\x08\x61
rg0_u64
\x18\x02
\x01
(
\x04\x12\x10\n\x08\x61
rg1_u64
\x18\x03
\x01
(
\x04\"\"\n\x04
Info
\x12\n\n\x02
id
\x18\x01
\x02
(
\x05\x12\x0e\n\x06
worker
\x18\x02
\x02
(
\t\"
6
\n\x05\x45
rror
\x12\n\n\x02
id
\x18\x01
\x02
(
\x05\x12\x0e\n\x06
worker
\x18\x02
\x02
(
\t\x12\x11\n\t
error_msg
\x18\x03
\x02
(
\t\"\xc6\x01\n\r
ClientMessage
\x12
*
\n\x04
type
\x18\x01
\x02
(
\x0e\x32\x1c
.loomcomm.ClientMessage.Type
\x12
$
\n\x04\x64\x61
ta
\x18\x02
\x01
(
\x0b\x32\x16
.loomcomm.DataPrologue
\x12\x1c\n\x04
info
\x18\x03
\x01
(
\x0b\x32\x0e
.loomcomm.Info
\x12\x1e\n\x05\x65
rror
\x18\x04
\x01
(
\x0b\x32\x0f
.loomcomm.Error
\"
%
\n\x04
Type
\x12\x08\n\x04\x44\x41
TA
\x10\x01\x12\x08\n\x04
INFO
\x10\x02\x12\t\n\x05\x45
RROR
\x10\x03\x42\x02
H
\x03
'
)
serialized_pb
=
_b
(
'
\n\x0e
loomcomm.proto
\x12\x08
loomcomm
\"\xbb\x01\n\x08
Register
\x12\x18\n\x10
protocol_version
\x18\x01
\x02
(
\x05\x12
%
\n\x04
type
\x18\x02
\x02
(
\x0e\x32\x17
.loomcomm.Register.Type
\x12\x0c\n\x04
port
\x18\x03
\x01
(
\x05\x12\x12\n\n
task_types
\x18\x04
\x03
(
\t\x12\x0c\n\x04\x63
pus
\x18\x05
\x01
(
\x05\x12\x0c\n\x04
info
\x18\n
\x01
(
\x08\"
0
\n\x04
Type
\x12\x13\n\x0f
REGISTER_WORKER
\x10\x01\x12\x13\n\x0f
REGISTER_CLIENT
\x10\x02\"
&
\n\r
ServerMessage
\"\x15\n\x04
Type
\x12\r\n\t
START_JOB
\x10\x01\"\xf1\x01\n\r
WorkerCommand
\x12
*
\n\x04
type
\x18\x01
\x02
(
\x0e\x32\x1c
.loomcomm.WorkerCommand.Type
\x12\n\n\x02
id
\x18\x02
\x01
(
\x05\x12\x11\n\t
task_type
\x18\x03
\x01
(
\x05\x12\x13\n\x0b
task_config
\x18\x04
\x01
(
\t\x12\x13\n\x0b
task_inputs
\x18\x05
\x03
(
\x05\x12\x0f\n\x07\x61\x64\x64
ress
\x18\n
\x01
(
\t\x12\x11\n\t
with_size
\x18\x0b
\x01
(
\x08\x12\x0f\n\x07
symbols
\x18\x64
\x03
(
\t\"
6
\n\x04
Type
\x12\x08\n\x04
TASK
\x10\x01\x12\x08\n\x04
SEND
\x10\x02\x12\n\n\x06
REMOVE
\x10\x03\x12\x0e\n\n
DICTIONARY
\x10\x04\"
\x9a\x01\n\x0e
WorkerResponse
\x12
+
\n\x04
type
\x18\x01
\x02
(
\x0e\x32\x1d
.loomcomm.WorkerResponse.Type
\x12\n\n\x02
id
\x18\x02
\x02
(
\x05\x12\x0c\n\x04
size
\x18\x03
\x01
(
\x04\x12\x0e\n\x06
length
\x18\x04
\x01
(
\x04\x12\x11\n\t
error_msg
\x18\x64
\x01
(
\t\"\x1e\n\x04
Type
\x12\n\n\x06\x46
INISH
\x10\x01\x12\n\n\x06\x46\x41
ILED
\x10\x02\"\x18\n\x08\x41
nnounce
\x12\x0c\n\x04
port
\x18\x01
\x02
(
\x05\"
-
\n\x0c\x44\x61
taPrologue
\x12\n\n\x02
id
\x18\x01
\x02
(
\x05\x12\x11\n\t
data_size
\x18\x03
\x01
(
\x04\"
Y
\n\x04\x44\x61
ta
\x12\x0f\n\x07
type_id
\x18\x01
\x02
(
\x05\x12\x0c\n\x04
size
\x18\x02
\x02
(
\x04\x12\x0e\n\x06
length
\x18\x03
\x01
(
\x04\x12\x10\n\x08\x61
rg0_u64
\x18\x08
\x01
(
\x04\x12\x10\n\x08\x61
rg1_u64
\x18\t
\x01
(
\x04\"\"\n\x04
Info
\x12\n\n\x02
id
\x18\x01
\x02
(
\x05\x12\x0e\n\x06
worker
\x18\x02
\x02
(
\t\"
6
\n\x05\x45
rror
\x12\n\n\x02
id
\x18\x01
\x02
(
\x05\x12\x0e\n\x06
worker
\x18\x02
\x02
(
\t\x12\x11\n\t
error_msg
\x18\x03
\x02
(
\t\"\xc6\x01\n\r
ClientMessage
\x12
*
\n\x04
type
\x18\x01
\x02
(
\x0e\x32\x1c
.loomcomm.ClientMessage.Type
\x12
$
\n\x04\x64\x61
ta
\x18\x02
\x01
(
\x0b\x32\x16
.loomcomm.DataPrologue
\x12\x1c\n\x04
info
\x18\x03
\x01
(
\x0b\x32\x0e
.loomcomm.Info
\x12\x1e\n\x05\x65
rror
\x18\x04
\x01
(
\x0b\x32\x0f
.loomcomm.Error
\"
%
\n\x04
Type
\x12\x08\n\x04\x44\x41
TA
\x10\x01\x12\x08\n\x04
INFO
\x10\x02\x12\t\n\x05\x45
RROR
\x10\x03\x42\x02
H
\x03
'
)
)
_sym_db
.
RegisterFileDescriptor
(
DESCRIPTOR
)
...
...
@@ -111,8 +111,8 @@ _WORKERRESPONSE_TYPE = _descriptor.EnumDescriptor(
],
containing_type
=
None
,
options
=
None
,
serialized_start
=
596
,
serialized_end
=
6
26
,
serialized_start
=
627
,
serialized_end
=
6
57
,
)
_sym_db
.
RegisterEnumDescriptor
(
_WORKERRESPONSE_TYPE
)
...
...
@@ -137,8 +137,8 @@ _CLIENTMESSAGE_TYPE = _descriptor.EnumDescriptor(
],
containing_type
=
None
,
options
=
None
,
serialized_start
=
10
16
,
serialized_end
=
1
053
,
serialized_start
=
10
77
,
serialized_end
=
1
114
,
)
_sym_db
.
RegisterEnumDescriptor
(
_CLIENTMESSAGE_TYPE
)
...
...
@@ -335,8 +335,22 @@ _WORKERRESPONSE = _descriptor.Descriptor(
is_extension
=
False
,
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'error_msg'
,
full_name
=
'loomcomm.WorkerResponse.error_msg'
,
index
=
2
,
number
=
3
,
type
=
9
,
cpp_type
=
9
,
label
=
1
,
name
=
'size'
,
full_name
=
'loomcomm.WorkerResponse.size'
,
index
=
2
,
number
=
3
,
type
=
4
,
cpp_type
=
4
,
label
=
1
,
has_default_value
=
False
,
default_value
=
0
,
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'length'
,
full_name
=
'loomcomm.WorkerResponse.length'
,
index
=
3
,
number
=
4
,
type
=
4
,
cpp_type
=
4
,
label
=
1
,
has_default_value
=
False
,
default_value
=
0
,
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'error_msg'
,
full_name
=
'loomcomm.WorkerResponse.error_msg'
,
index
=
4
,
number
=
100
,
type
=
9
,
cpp_type
=
9
,
label
=
1
,
has_default_value
=
False
,
default_value
=
_b
(
""
).
decode
(
'utf-8'
),
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
...
...
@@ -353,8 +367,8 @@ _WORKERRESPONSE = _descriptor.Descriptor(
extension_ranges
=
[],
oneofs
=
[
],
serialized_start
=
50
2
,
serialized_end
=
6
26
,
serialized_start
=
50
3
,
serialized_end
=
6
57
,
)
...
...
@@ -383,8 +397,8 @@ _ANNOUNCE = _descriptor.Descriptor(
extension_ranges
=
[],
oneofs
=
[
],
serialized_start
=
6
28
,
serialized_end
=
6
52
,
serialized_start
=
6
59
,
serialized_end
=
6
83
,
)
...
...
@@ -420,8 +434,8 @@ _DATAPROLOGUE = _descriptor.Descriptor(
extension_ranges
=
[],
oneofs
=
[
],
serialized_start
=
6
54
,
serialized_end
=
699
,
serialized_start
=
6
85
,
serialized_end
=
730
,
)
...
...
@@ -440,19 +454,33 @@ _DATA = _descriptor.Descriptor(
is_extension
=
False
,
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'
arg0_u64'
,
full_name
=
'loomcomm.Data.arg0_u64
'
,
index
=
1
,
number
=
2
,
type
=
4
,
cpp_type
=
4
,
label
=
1
,
name
=
'
size'
,
full_name
=
'loomcomm.Data.size
'
,
index
=
1
,
number
=
2
,
type
=
4
,
cpp_type
=
4
,
label
=
2
,
has_default_value
=
False
,
default_value
=
0
,
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'
arg1_u64'
,
full_name
=
'loomcomm.Data.arg1_u64
'
,
index
=
2
,
name
=
'
length'
,
full_name
=
'loomcomm.Data.length
'
,
index
=
2
,
number
=
3
,
type
=
4
,
cpp_type
=
4
,
label
=
1
,
has_default_value
=
False
,
default_value
=
0
,
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'arg0_u64'
,
full_name
=
'loomcomm.Data.arg0_u64'
,
index
=
3
,
number
=
8
,
type
=
4
,
cpp_type
=
4
,
label
=
1
,
has_default_value
=
False
,
default_value
=
0
,
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'arg1_u64'
,
full_name
=
'loomcomm.Data.arg1_u64'
,
index
=
4
,
number
=
9
,
type
=
4
,
cpp_type
=
4
,
label
=
1
,
has_default_value
=
False
,
default_value
=
0
,
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
options
=
None
),
],
extensions
=
[
],
...
...
@@ -464,8 +492,8 @@ _DATA = _descriptor.Descriptor(
extension_ranges
=
[],
oneofs
=
[
],
serialized_start
=
7
01
,
serialized_end
=
760
,
serialized_start
=
7
32
,
serialized_end
=
821
,
)
...
...
@@ -501,8 +529,8 @@ _INFO = _descriptor.Descriptor(
extension_ranges
=
[],
oneofs
=
[
],
serialized_start
=
762
,
serialized_end
=
796
,
serialized_start
=
823
,
serialized_end
=
857
,
)
...
...
@@ -545,8 +573,8 @@ _ERROR = _descriptor.Descriptor(
extension_ranges
=
[],
oneofs
=
[
],
serialized_start
=
798
,
serialized_end
=
852
,
serialized_start
=
859
,
serialized_end
=
913
,
)
...
...
@@ -597,8 +625,8 @@ _CLIENTMESSAGE = _descriptor.Descriptor(
extension_ranges
=
[],
oneofs
=
[
],
serialized_start
=
855
,
serialized_end
=
1
053
,
serialized_start
=
916
,
serialized_end
=
1
114
,
)
_REGISTER
.
fields_by_name
[
'type'
].
enum_type
=
_REGISTER_TYPE
...
...
src/libloom/data.cpp
View file @
473e3067
...
...
@@ -8,11 +8,20 @@ Data::~Data() {
}
size_t
Data
::
get_length
()
const
{
return
0
;
}
void
Data
::
serialize
(
Worker
&
worker
,
SendBuffer
&
buffer
,
std
::
shared_ptr
<
Data
>
&
data_ptr
)
{
loomcomm
::
Data
msg
;
msg
.
set_type_id
(
get_type_id
());
//msg.set_size(get_size());
msg
.
set_size
(
get_size
());
auto
length
=
get_length
();
if
(
length
)
{
msg
.
set_length
(
length
);
}
init_message
(
worker
,
msg
);
buffer
.
add
(
msg
);
serialize_data
(
worker
,
buffer
,
data_ptr
);
...
...
src/libloom/data.h
View file @
473e3067
...
...
@@ -21,9 +21,9 @@ public:
virtual
~
Data
();
virtual
int
get_type_id
()
=
0
;
virtual
size_t
get_size
()
=
0
;
virtual
std
::
string
get_info
()
=
0
;
virtual
size_t
get_length
()
const
;
void
serialize
(
Worker
&
worker
,
SendBuffer
&
buffer
,
std
::
shared_ptr
<
Data
>
&
data_ptr
);
virtual
void
init_message
(
Worker
&
worker
,
loomcomm
::
Data
&
msg
)
const
;
...
...
src/libloom/data/array.cpp
View file @
473e3067
...
...
@@ -42,11 +42,6 @@ void loom::Array::serialize_data(loom::Worker &worker, loom::SendBuffer &buffer,
}
}
void
loom
::
Array
::
init_message
(
loom
::
Worker
&
worker
,
loomcomm
::
Data
&
msg
)
const
{
msg
.
set_arg0_u64
(
length
);
}
loom
::
ArrayUnpacker
::~
ArrayUnpacker
()
{
...
...
@@ -54,9 +49,8 @@ loom::ArrayUnpacker::~ArrayUnpacker()
bool
loom
::
ArrayUnpacker
::
init
(
loom
::
Worker
&
worker
,
loom
::
Connection
&
connection
,
const
loomcomm
::
Data
&
msg
)
{
assert
(
msg
.
has_arg0_u64
()
);
length
=
msg
.
length
(
);
index
=
0
;
length
=
msg
.
arg0_u64
();
items
=
std
::
make_unique
<
std
::
shared_ptr
<
Data
>
[]
>
(
length
);
if
(
length
==
0
)
{
finish
();
...
...
src/libloom/data/array.h
View file @
473e3067
...
...
@@ -25,7 +25,6 @@ public:
std
::
shared_ptr
<
Data
>&
get_at_index
(
size_t
index
);
void
serialize_data
(
Worker
&
worker
,
SendBuffer
&
buffer
,
std
::
shared_ptr
<
Data
>
&
data_ptr
);
void
init_message
(
Worker
&
worker
,
loomcomm
::
Data
&
msg
)
const
;
private:
size_t
length
;
...
...
src/libloom/data/rawdata.cpp
View file @
473e3067
...
...
@@ -138,11 +138,6 @@ std::string RawData::get_info()
return
"RawData"
;
}
void
RawData
::
init_message
(
Worker
&
worker
,
loomcomm
::
Data
&
msg
)
const
{
msg
.
set_arg0_u64
(
size
);
}
void
RawData
::
serialize_data
(
Worker
&
worker
,
SendBuffer
&
buffer
,
std
::
shared_ptr
<
Data
>
&
data_ptr
)
{
buffer
.
add
(
data_ptr
,
get_raw_data
(
worker
),
size
);
...
...
@@ -157,8 +152,7 @@ bool RawDataUnpacker::init(Worker &worker, Connection &connection, const loomcom
{
this
->
data
=
std
::
make_shared
<
RawData
>
();
RawData
&
data
=
static_cast
<
RawData
&>
(
*
this
->
data
);
assert
(
msg
.
has_arg0_u64
());
auto
size
=
msg
.
arg0_u64
();
size_t
size
=
msg
.
size
();
pointer
=
data
.
init_empty_file
(
worker
,
size
);
if
(
size
==
0
)
{
return
true
;
...
...
src/libloom/data/rawdata.h
View file @
473e3067
...
...
@@ -28,8 +28,7 @@ public:
return
data
;
}
std
::
string
get_info
();
void
init_message
(
Worker
&
worker
,
loomcomm
::
Data
&
msg
)
const
;
std
::
string
get_info
();
void
serialize_data
(
Worker
&
worker
,
SendBuffer
&
buffer
,
std
::
shared_ptr
<
Data
>
&
data_ptr
);
//char* init_memonly(size_t size);
...
...
src/libloom/interconnect.h
View file @
473e3067
...
...
@@ -19,7 +19,7 @@ public:
InterConnection
(
Worker
&
worker
);
~
InterConnection
();
void
send
(
Id
id
,
std
::
shared_ptr
<
Data
>
&
data
,
bool
with_size
);
void
send
(
Id
id
,
std
::
shared_ptr
<
Data
>
&
data
,
bool
with_size
);
void
accept
(
uv_tcp_t
*
listen_socket
)
{
connection
.
accept
(
listen_socket
);
}
...
...
src/libloom/loomcomm.pb.cc
View file @
473e3067
...
...
@@ -1143,6 +1143,8 @@ const int WorkerResponse::Type_ARRAYSIZE;
#ifndef _MSC_VER
const
int
WorkerResponse
::
kTypeFieldNumber
;
const
int
WorkerResponse
::
kIdFieldNumber
;
const
int
WorkerResponse
::
kSizeFieldNumber
;
const
int
WorkerResponse
::
kLengthFieldNumber
;
const
int
WorkerResponse
::
kErrorMsgFieldNumber
;
#endif // !_MSC_VER
...
...
@@ -1167,6 +1169,8 @@ void WorkerResponse::SharedCtor() {
_cached_size_
=
0
;
type_
=
1
;
id_
=
0
;
size_
=
GOOGLE_ULONGLONG
(
0
);
length_
=
GOOGLE_ULONGLONG
(
0
);
error_msg_
=
const_cast
<
::
std
::
string
*>
(
&::
google
::
protobuf
::
internal
::
GetEmptyStringAlreadyInited
());
::
memset
(
_has_bits_
,
0
,
sizeof
(
_has_bits_
));
}
...
...
@@ -1209,15 +1213,29 @@ WorkerResponse* WorkerResponse::New() const {
}
void
WorkerResponse
::
Clear
()
{
if
(
_has_bits_
[
0
/
32
]
&
7
)
{
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<WorkerResponse*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if
(
_has_bits_
[
0
/
32
]
&
31
)
{
ZR_
(
id_
,
length_
);
type_
=
1
;
id_
=
0
;
if
(
has_error_msg
())
{
if
(
error_msg_
!=
&::
google
::
protobuf
::
internal
::
GetEmptyStringAlreadyInited
())
{
error_msg_
->
clear
();
}
}
}
#undef OFFSET_OF_FIELD_
#undef ZR_
::
memset
(
_has_bits_
,
0
,
sizeof
(
_has_bits_
));
mutable_unknown_fields
()
->
clear
();
}
...
...
@@ -1232,7 +1250,7 @@ bool WorkerResponse::MergePartialFromCodedStream(
&
unknown_fields_string
);
// @@protoc_insertion_point(parse_start:loomcomm.WorkerResponse)
for
(;;)
{
::
std
::
pair
<
::
google
::
protobuf
::
uint32
,
bool
>
p
=
input
->
ReadTagWithCutoff
(
1
27
);
::
std
::
pair
<
::
google
::
protobuf
::
uint32
,
bool
>
p
=
input
->
ReadTagWithCutoff
(
1
6383
);
tag
=
p
.
first
;
if
(
!
p
.
second
)
goto
handle_unusual
;
switch
(
::
google
::
protobuf
::
internal
::
WireFormatLite
::
GetTagFieldNumber
(
tag
))
{
...
...
@@ -1267,13 +1285,43 @@ bool WorkerResponse::MergePartialFromCodedStream(
}
else
{
goto
handle_unusual
;
}
if
(
input
->
ExpectTag
(
2
6
))
goto
parse_error_msg
;
if
(
input
->
ExpectTag
(
2
4
))
goto
parse_size
;
break
;
}
// optional
string error_msg
= 3;
// optional
uint64 size
= 3;
case
3
:
{
if
(
tag
==
26
)
{
if
(
tag
==
24
)
{
parse_size:
DO_
((
::
google
::
protobuf
::
internal
::
WireFormatLite
::
ReadPrimitive
<
::
google
::
protobuf
::
uint64
,
::
google
::
protobuf
::
internal
::
WireFormatLite
::
TYPE_UINT64
>
(
input
,
&
size_
)));
set_has_size
();
}
else
{
goto
handle_unusual
;
}
if
(
input
->
ExpectTag
(
32
))
goto
parse_length
;
break
;
}
// optional uint64 length = 4;
case
4
:
{
if
(
tag
==
32
)
{
parse_length:
DO_
((
::
google
::
protobuf
::
internal
::
WireFormatLite
::
ReadPrimitive
<
::
google
::
protobuf
::
uint64
,
::
google
::
protobuf
::
internal
::
WireFormatLite
::
TYPE_UINT64
>
(
input
,
&
length_
)));
set_has_length
();
}
else
{
goto
handle_unusual
;
}
if
(
input
->
ExpectTag
(
802
))
goto
parse_error_msg
;
break
;
}
// optional string error_msg = 100;
case
100
:
{
if
(
tag
==
802
)
{
parse_error_msg:
DO_
(
::
google
::
protobuf
::
internal
::
WireFormatLite
::
ReadString
(
input
,
this
->
mutable_error_msg
()));
...
...
@@ -1320,10 +1368,20 @@ void WorkerResponse::SerializeWithCachedSizes(
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WriteInt32
(
2
,
this
->
id
(),
output
);
}
// optional string error_msg = 3;
// optional uint64 size = 3;
if
(
has_size
())
{
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WriteUInt64
(
3
,
this
->
size
(),
output
);
}
// optional uint64 length = 4;
if
(
has_length
())
{
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WriteUInt64
(
4
,
this
->
length
(),
output
);
}
// optional string error_msg = 100;
if
(
has_error_msg
())
{
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WriteStringMaybeAliased
(
3
,
this
->
error_msg
(),
output
);
100
,
this
->
error_msg
(),
output
);
}
output
->
WriteRaw
(
unknown_fields
().
data
(),
...
...
@@ -1348,9 +1406,23 @@ int WorkerResponse::ByteSize() const {
this
->
id
());
}
// optional string error_msg = 3;
if
(
has_error_msg
())
{
// optional uint64 size = 3;
if
(
has_size
())
{
total_size
+=
1
+
::
google
::
protobuf
::
internal
::
WireFormatLite
::
UInt64Size
(
this
->
size
());
}
// optional uint64 length = 4;
if
(
has_length
())
{
total_size
+=
1
+
::
google
::
protobuf
::
internal
::
WireFormatLite
::
UInt64Size
(
this
->
length
());
}
// optional string error_msg = 100;
if
(
has_error_msg
())
{
total_size
+=
2
+
::
google
::
protobuf
::
internal
::
WireFormatLite
::
StringSize
(
this
->
error_msg
());
}
...
...
@@ -1378,6 +1450,12 @@ void WorkerResponse::MergeFrom(const WorkerResponse& from) {
if
(
from
.
has_id
())
{
set_id
(
from
.
id
());
}
if
(
from
.
has_size
())
{
set_size
(
from
.
size
());
}
if
(
from
.
has_length
())
{
set_length
(
from
.
length
());
}
if
(
from
.
has_error_msg
())
{
set_error_msg
(
from
.
error_msg
());
}
...
...
@@ -1401,6 +1479,8 @@ void WorkerResponse::Swap(WorkerResponse* other) {
if
(
other
!=
this
)
{
std
::
swap
(
type_
,
other
->
type_
);
std
::
swap
(
id_
,
other
->
id_
);
std
::
swap
(
size_
,
other
->
size_
);
std
::
swap
(
length_
,
other
->
length_
);
std
::
swap
(
error_msg_
,
other
->
error_msg_
);
std
::
swap
(
_has_bits_
[
0
],
other
->
_has_bits_
[
0
]);
_unknown_fields_
.
swap
(
other
->
_unknown_fields_
);
...
...
@@ -1848,6 +1928,8 @@ void DataPrologue::Swap(DataPrologue* other) {
#ifndef _MSC_VER
const
int
Data
::
kTypeIdFieldNumber
;
const
int
Data
::
kSizeFieldNumber
;
const
int
Data
::
kLengthFieldNumber
;
const
int
Data
::
kArg0U64FieldNumber
;
const
int
Data
::
kArg1U64FieldNumber
;
#endif // !_MSC_VER
...
...
@@ -1871,6 +1953,8 @@ Data::Data(const Data& from)
void
Data
::
SharedCtor
()
{
_cached_size_
=
0
;
type_id_
=
0
;
size_
=
GOOGLE_ULONGLONG
(
0
);
length_
=
GOOGLE_ULONGLONG
(
0
);
arg0_u64_
=
GOOGLE_ULONGLONG
(
0
);
arg1_u64_
=
GOOGLE_ULONGLONG
(
0
);
::
memset
(
_has_bits_
,
0
,
sizeof
(
_has_bits_
));
...
...
@@ -1921,7 +2005,9 @@ void Data::Clear() {
::memset(&first, 0, n); \
} while (0)
ZR_
(
arg0_u64_
,
type_id_
);
if
(
_has_bits_
[
0
/
32
]
&
31
)
{
ZR_
(
size_
,
type_id_
);
}
#undef OFFSET_OF_FIELD_
#undef ZR_
...
...
@@ -1954,13 +2040,43 @@ bool Data::MergePartialFromCodedStream(
}
else
{
goto
handle_unusual
;
}
if
(
input
->
ExpectTag
(
16
))
goto
parse_
arg0_u64
;
if
(
input
->
ExpectTag
(
16
))
goto
parse_
size
;
break
;
}
//
optional uint64 arg0_u64
= 2;
//
required uint64 size
= 2;
case
2
:
{
if
(
tag
==
16
)
{
parse_size:
DO_
((
::
google
::
protobuf
::
internal
::
WireFormatLite
::
ReadPrimitive
<
::
google
::
protobuf
::
uint64
,
::
google
::
protobuf
::
internal
::
WireFormatLite
::
TYPE_UINT64
>
(
input
,
&
size_
)));
set_has_size
();
}
else
{
goto
handle_unusual
;
}
if
(
input
->
ExpectTag
(
24
))
goto
parse_length
;
break
;
}
// optional uint64 length = 3;
case
3
:
{
if
(
tag
==
24
)
{
parse_length:
DO_
((
::
google
::
protobuf
::
internal
::
WireFormatLite
::
ReadPrimitive
<
::
google
::
protobuf
::
uint64
,
::
google
::
protobuf
::
internal
::
WireFormatLite
::
TYPE_UINT64
>
(
input
,
&
length_
)));
set_has_length
();
}
else
{
goto
handle_unusual
;
}
if
(
input
->
ExpectTag
(
64
))
goto
parse_arg0_u64
;
break
;
}
// optional uint64 arg0_u64 = 8;
case
8
:
{
if
(
tag
==
64
)
{
parse_arg0_u64:
DO_
((
::
google
::
protobuf
::
internal
::
WireFormatLite
::
ReadPrimitive
<
::
google
::
protobuf
::
uint64
,
::
google
::
protobuf
::
internal
::
WireFormatLite
::
TYPE_UINT64
>
(
...
...
@@ -1969,13 +2085,13 @@ bool Data::MergePartialFromCodedStream(
}
else
{
goto
handle_unusual
;
}
if
(
input
->
ExpectTag
(
24
))
goto
parse_arg1_u64
;
if
(
input
->
ExpectTag
(
72
))
goto
parse_arg1_u64
;
break
;
}
// optional uint64 arg1_u64 =
3
;
case
3
:
{
if
(
tag
==
24
)
{
// optional uint64 arg1_u64 =
9
;
case
9
:
{
if
(
tag
==
72
)
{
parse_arg1_u64:
DO_
((
::
google
::
protobuf
::
internal
::
WireFormatLite
::
ReadPrimitive
<
::
google
::
protobuf
::
uint64
,
::
google
::
protobuf
::
internal
::
WireFormatLite
::
TYPE_UINT64
>
(
...
...
@@ -2018,14 +2134,24 @@ void Data::SerializeWithCachedSizes(
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WriteInt32
(
1
,
this
->
type_id
(),
output
);
}
// optional uint64 arg0_u64 = 2;
// required uint64 size = 2;
if
(
has_size
())
{
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WriteUInt64
(
2
,
this
->
size
(),
output
);
}
// optional uint64 length = 3;
if
(
has_length
())
{
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WriteUInt64
(
3
,
this
->
length
(),
output
);
}
// optional uint64 arg0_u64 = 8;
if
(
has_arg0_u64
())
{
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WriteUInt64
(
2
,
this
->
arg0_u64
(),
output
);
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WriteUInt64
(
8
,
this
->
arg0_u64
(),
output
);
}
// optional uint64 arg1_u64 =
3
;
// optional uint64 arg1_u64 =
9
;
if
(
has_arg1_u64
())
{
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WriteUInt64
(
3
,
this
->
arg1_u64
(),
output
);
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WriteUInt64
(
9
,
this
->
arg1_u64
(),
output
);
}
output
->
WriteRaw
(
unknown_fields
().
data
(),
...
...
@@ -2044,14 +2170,28 @@ int Data::ByteSize() const {
this
->
type_id
());
}
// optional uint64 arg0_u64 = 2;
// required uint64 size = 2;
if
(
has_size
())
{
total_size
+=
1
+
::
google
::
protobuf
::
internal
::
WireFormatLite
::
UInt64Size
(
this
->
size
());
}
// optional uint64 length = 3;
if
(
has_length
())
{
total_size
+=
1
+
::
google
::
protobuf
::
internal
::
WireFormatLite
::
UInt64Size
(
this
->
length
());
}
// optional uint64 arg0_u64 = 8;
if
(
has_arg0_u64
())
{
total_size
+=
1
+
::
google
::
protobuf
::
internal
::
WireFormatLite
::
UInt64Size
(
this
->
arg0_u64
());
}
// optional uint64 arg1_u64 =
3
;
// optional uint64 arg1_u64 =
9
;
if
(
has_arg1_u64
())
{
total_size
+=
1
+
::
google
::
protobuf
::
internal
::
WireFormatLite
::
UInt64Size
(
...
...
@@ -2078,6 +2218,12 @@ void Data::MergeFrom(const Data& from) {
if
(
from
.
has_type_id
())
{
set_type_id
(
from
.
type_id
());
}
if
(
from
.
has_size
())
{
set_size
(
from
.
size
());
}
if
(
from
.
has_length
())
{
set_length
(
from
.
length
());
}
if
(
from
.
has_arg0_u64
())
{