diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-01-18 10:51:34 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-01-18 10:51:34 +0100 |
commit | 47b4442c585a25b2e4b857f2d9e3ab371d942c19 (patch) | |
tree | 4167c6cb75e3ee8072452585f1b433fb637e3389 /dummyresource/facade.cpp | |
parent | aef2ebc45a30d3c3b15b630648e8b37a551ce1ef (diff) | |
download | sink-47b4442c585a25b2e4b857f2d9e3ab371d942c19.tar.gz sink-47b4442c585a25b2e4b857f2d9e3ab371d942c19.zip |
Use jobs to track progress of write commands.
Diffstat (limited to 'dummyresource/facade.cpp')
-rw-r--r-- | dummyresource/facade.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/dummyresource/facade.cpp b/dummyresource/facade.cpp index 668fbbf..13c174b 100644 --- a/dummyresource/facade.cpp +++ b/dummyresource/facade.cpp | |||
@@ -46,7 +46,7 @@ DummyResourceFacade::~DummyResourceFacade() | |||
46 | { | 46 | { |
47 | } | 47 | } |
48 | 48 | ||
49 | void DummyResourceFacade::create(const Akonadi2::Domain::Event &domainObject) | 49 | Async::Job<void> DummyResourceFacade::create(const Akonadi2::Domain::Event &domainObject) |
50 | { | 50 | { |
51 | //Create message buffer and send to resource | 51 | //Create message buffer and send to resource |
52 | flatbuffers::FlatBufferBuilder eventFbb; | 52 | flatbuffers::FlatBufferBuilder eventFbb; |
@@ -64,24 +64,28 @@ void DummyResourceFacade::create(const Akonadi2::Domain::Event &domainObject) | |||
64 | Akonadi2::EntityBuffer::assembleEntityBuffer(entityFbb, 0, 0, eventFbb.GetBufferPointer(), eventFbb.GetSize(), 0, 0); | 64 | Akonadi2::EntityBuffer::assembleEntityBuffer(entityFbb, 0, 0, eventFbb.GetBufferPointer(), eventFbb.GetSize(), 0, 0); |
65 | 65 | ||
66 | flatbuffers::FlatBufferBuilder fbb; | 66 | flatbuffers::FlatBufferBuilder fbb; |
67 | auto type = fbb.CreateString(Akonadi2::Domain::getTypeName<Akonadi2::Domain::Event>().toStdString().data()); | 67 | //This is the resource type and not the domain type |
68 | auto type = fbb.CreateString("event"); | ||
68 | auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); | 69 | auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); |
69 | Akonadi2::Commands::CreateEntityBuilder builder(fbb); | 70 | Akonadi2::Commands::CreateEntityBuilder builder(fbb); |
70 | builder.add_domainType(type); | 71 | builder.add_domainType(type); |
71 | builder.add_delta(delta); | 72 | builder.add_delta(delta); |
72 | auto location = builder.Finish(); | 73 | auto location = builder.Finish(); |
73 | Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); | 74 | Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); |
74 | mResourceAccess->sendCommand(Akonadi2::Commands::CreateEntityCommand, fbb); | 75 | mResourceAccess->open(); |
76 | return mResourceAccess->sendCommand(Akonadi2::Commands::CreateEntityCommand, fbb); | ||
75 | } | 77 | } |
76 | 78 | ||
77 | void DummyResourceFacade::modify(const Akonadi2::Domain::Event &domainObject) | 79 | Async::Job<void> DummyResourceFacade::modify(const Akonadi2::Domain::Event &domainObject) |
78 | { | 80 | { |
79 | //Create message buffer and send to resource | 81 | //Create message buffer and send to resource |
82 | return Async::null<void>(); | ||
80 | } | 83 | } |
81 | 84 | ||
82 | void DummyResourceFacade::remove(const Akonadi2::Domain::Event &domainObject) | 85 | Async::Job<void> DummyResourceFacade::remove(const Akonadi2::Domain::Event &domainObject) |
83 | { | 86 | { |
84 | //Create message buffer and send to resource | 87 | //Create message buffer and send to resource |
88 | return Async::null<void>(); | ||
85 | } | 89 | } |
86 | 90 | ||
87 | static std::function<bool(const std::string &key, DummyEvent const *buffer)> prepareQuery(const Akonadi2::Query &query) | 91 | static std::function<bool(const std::string &key, DummyEvent const *buffer)> prepareQuery(const Akonadi2::Query &query) |