Peter Johnson
83be99e78c
Immediately process incoming messages.
...
This required moving message processing into the Storage class.
2015-07-29 23:45:04 -07:00
Peter Johnson
5b5e3ae6aa
Dispatcher: Start implementing processing of incoming messages.
2015-07-29 20:33:26 -07:00
Peter Johnson
f6576b18f7
Storage: Add more Dispatcher accessors.
2015-07-29 20:33:13 -07:00
Peter Johnson
9a621e9272
Various NetworkConnection improvements.
...
- Keep connection state.
- Store remote id
- Getter for proto_rev
- Cleanup on Stop()
- Cleaner termination of write thread.
2015-07-29 20:31:59 -07:00
Peter Johnson
c01f2977ac
StorageEntry: Make value() const.
2015-07-28 22:29:58 -07:00
Peter Johnson
683c53babc
Message::str(): Return StringRef.
2015-07-28 22:07:02 -07:00
Peter Johnson
5823e3c780
Storage: Add CreateEntry function for Dispatcher use.
2015-07-28 22:06:42 -07:00
Peter Johnson
a0d30ffef1
Storage: Use StringMap instead of ConcurrentQueue for updates.
...
Updates are merged or themselves updated as user code changes. This avoids
the need for the dispatcher to do this and also avoids the need for disabling
updates when the dispatcher isn't running, because there's no risk of memory
usage piling up.
2015-07-26 20:41:48 -07:00
Peter Johnson
fb1b82e239
StorageEntry: Also store copy of name here.
...
This wastes a bit of space but is necessary for assign message generation.
2015-07-26 10:28:20 -07:00
Peter Johnson
3bc5699ba1
Storage: Provide accessor for global mutex.
2015-07-26 09:42:14 -07:00
Peter Johnson
18659257d3
Storage: Make setters globally atomic.
...
Previously, setters were locally but not globally atomic because they
used GetEntry() (globally atomic) in conjunction with locally atomic
gets/sets to the StorageEntry. To support synchronizing network handshakes
they need to be globally atomic.
GetEntry() has been removed due to this issue, so a helper was added to
StorageTest instead.
2015-07-26 09:27:23 -07:00
Peter Johnson
3c7cb363ba
NetworkConnection: Prefer emplace to push.
2015-07-25 10:47:53 -07:00
Peter Johnson
3f24b86875
ITable: Add Persist function to make a key persistent.
2015-07-23 21:53:33 -07:00
Peter Johnson
1368f0ec8f
NetworkTable: Use networktables.ini as persistence filename.
2015-07-23 21:47:54 -07:00
Peter Johnson
196fcf791b
ITable: Const'ify getter functions.
2015-07-23 21:46:30 -07:00
Peter Johnson
8fa0e6c914
Add shims for old NetworkTable interface.
...
This provides classes for virtual subtables using path delimiters within
the global NetworkTable namespace.
2015-07-23 01:23:09 -07:00
Peter Johnson
6f940bcaaf
Add immediate_notify and is_new to entry listener.
...
On the callback function, is_new indicates the value is newly added.
On adding a callback function, immediate_notify indicates the callback
should be called once (with is_new=true) for each matching entry that
already exists.
2015-07-23 01:02:53 -07:00
Peter Johnson
79f732f239
Import llvm::SmallString and dependencies.
...
Update StringRef and StringExtras with SmallVector functions.
2015-07-22 22:29:46 -07:00
Peter Johnson
593bc28446
Move StringMap.h and StringExtras.h to public includes.
...
While these aren't required by the public interface, they are generally
useful classes for users of the library.
2015-07-22 22:10:56 -07:00
Peter Johnson
4aa2d65bba
Storage: Use std::forward and emplace for updates.
2015-07-21 22:43:44 -07:00
Peter Johnson
bb5848a033
ConcurrentQueue: Add emplace function.
...
Also use std::forward for rvalue push.
2015-07-21 22:43:02 -07:00
Peter Johnson
b4c65dc210
Make global instance init thread-safe.
...
Use local statics except for Visual C++ < 2015.
2015-07-20 23:36:22 -07:00
Peter Johnson
5df62ac172
Storage: Disable use of update queue by default.
...
This ensures we don't "leak" memory for local use when the dispatch thread
is not running.
2015-07-20 22:24:47 -07:00
Peter Johnson
0979c1c9ca
Storage, NetworkConnection: Don't in-place construct atomics.
...
Visual C++ 2013 doesn't support this.
2015-07-20 20:52:26 -07:00
Peter Johnson
3cd3d1691e
Message: Use #define instead of constexpr.
2015-07-20 20:34:19 -07:00
Peter Johnson
6b2fb02bed
Dispatcher: Don't in-place construct atomics.
...
Visual C++ 2013 doesn't support this.
2015-07-20 20:21:37 -07:00
Peter Johnson
8938a19810
Dispatcher: Avoid warning by using for(;;) instead of while(true).
2015-07-20 20:20:01 -07:00
Peter Johnson
158ae61811
Dispatcher::SetUpdateRate(): Explicitly convert to int.
2015-07-20 20:19:01 -07:00
Peter Johnson
c9260ea785
Change GetEntryTypeFunc to std::function.
...
Also implement it as a member function of Dispatcher.
2015-07-19 23:17:14 -07:00
Peter Johnson
a3fcce891f
LoadPersistent: Fix various bugs.
2015-07-19 22:44:34 -07:00
Peter Johnson
8db016c223
SavePersistent: Sort in name order, fix list commas.
2015-07-19 21:10:20 -07:00
Peter Johnson
e4731a4e4e
Storage::GetEntryInfo: Actually filter on types.
2015-07-19 19:42:13 -07:00
Peter Johnson
d6afbc56c4
Storage: Delete functions now delete from map.
...
This is ok due to the map storing shared_ptr.
2015-07-19 18:10:26 -07:00
Peter Johnson
ffb54872c0
Storage::SetEntryFlags(): Fix deadlock, check for empty name.
2015-07-19 17:50:31 -07:00
Peter Johnson
ead6b4960f
Storage: Use make_shared instead of reset.
2015-07-19 16:46:59 -07:00
Peter Johnson
21b7acc397
Storage: Make testable, make EntriesMap typedef private.
2015-07-19 16:36:30 -07:00
Peter Johnson
173111c64c
ConcurrentQueue: Make mutex mutable.
2015-07-19 16:36:08 -07:00
Peter Johnson
1cc148848b
StartServer: Take persist_filename as a StringRef.
2015-07-19 16:11:56 -07:00
Peter Johnson
ec54904347
Tighten up C++ API implementation a bit.
2015-07-19 16:09:59 -07:00
Peter Johnson
0a18d2e57b
Storage: Make individual entries thread safe.
...
Also use shared_ptr to refer to entries rather than names.
2015-07-19 16:02:21 -07:00
Peter Johnson
c08e2ed8fc
ConcurrentQueue: Add size() function.
2015-07-18 01:32:21 -07:00
Peter Johnson
2437f06c7f
Implement majority of Storage functionality.
...
It's also now thread-safe.
2015-07-18 01:29:51 -07:00
Peter Johnson
9b7e265762
Continue implementing client.
2015-07-18 01:29:24 -07:00
Peter Johnson
c4a7f6ec9b
SavePersistent: Safely save through temp file.
...
Also change SavePersistent and LoadPersistent to take StringRef.
2015-07-18 00:39:08 -07:00
Peter Johnson
d05656b716
StorageEntry: Make data public, remove accessors.
...
Also add id and seq_num fields.
2015-07-17 23:41:25 -07:00
Peter Johnson
04789d9ae4
SequenceNumber: Add default constructor.
2015-07-17 23:41:05 -07:00
Peter Johnson
77acf1f35b
Implement Flush() API.
2015-07-17 22:40:00 -07:00
Peter Johnson
412e8034de
Start implementing client and server.
2015-07-17 22:39:36 -07:00
Peter Johnson
a6162ba990
NetworkConnection: Trigger threads as necessary in Stop().
2015-07-17 22:28:47 -07:00
Peter Johnson
7c51178608
TCPAcceptor: Add shutdown() function.
2015-07-17 22:28:13 -07:00