forked from scylladb/scylladb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstream_transfer_task.hh
56 lines (45 loc) · 1.31 KB
/
stream_transfer_task.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
*
* Modified by ScyllaDB
* Copyright (C) 2015-present ScyllaDB
*/
/*
* SPDX-License-Identifier: (AGPL-3.0-or-later and Apache-2.0)
*/
#pragma once
#include "utils/UUID.hh"
#include "streaming/stream_task.hh"
#include "streaming/stream_detail.hh"
#include <map>
#include <seastar/core/semaphore.hh>
namespace streaming {
class stream_session;
class send_info;
/**
* StreamTransferTask sends sections of SSTable files in certain ColumnFamily.
*/
class stream_transfer_task : public stream_task {
private:
// A stream_transfer_task always contains the same range to stream
dht::token_range_vector _ranges;
std::map<unsigned, dht::partition_range_vector> _shard_ranges;
long _total_size;
public:
using UUID = utils::UUID;
stream_transfer_task(stream_transfer_task&&) = default;
stream_transfer_task(shared_ptr<stream_session> session, UUID cf_id, dht::token_range_vector ranges, long total_size = 0);
~stream_transfer_task();
public:
virtual void abort() override {
}
virtual int get_total_number_of_files() const override {
return 1;
}
virtual long get_total_size() const override {
return _total_size;
}
future<> execute();
void append_ranges(const dht::token_range_vector& ranges);
void sort_and_merge_ranges();
};
} // namespace streaming