Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geo: geo library support #74

Merged
merged 69 commits into from
Jul 11, 2018
Merged

Geo: geo library support #74

merged 69 commits into from
Jul 11, 2018

Conversation

acelyc111
Copy link
Member

@acelyc111 acelyc111 commented Jun 9, 2018

  • add geo library, support set/del/search_radial/distance APIs
  • integrate the library into redis proxy

// ./pegasus_geo_test onebox temp temp_geo
int main(int argc, char **argv)
{
if (argc != 4) {

This comment was marked as resolved.

auto extractor = [](const std::string &value, S2LatLng &latlng) {
std::vector<std::string> data;
dsn::utils::split_args(value.c_str(), data, '|');
if (data.size() <= 6) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

< 6

return ret;
}

void geo_client::async_del(const std::string &hash_key,

This comment was marked as resolved.

int timeout_milliseconds,
int ttl_seconds)
{
async_del(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

另外在set的时候有没有必要check下现在的经纬度是不是和之前的一样?一样是不是可以做一些优化?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个没有必要,一是我们不对业务数据做假设,二是没必要增加逻辑复杂度

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

也还好吧,反正set前会有一轮get的。感觉不会增加多大复杂度。而且业务是那种没事灌一批的话去,其实这么做也是挺值得的。
可以先留个TODO

scan_one_area_callback &&callback,
std::vector<SearchResult> &result)
{
dsn::tasking::enqueue(LPC_GEO_SCAN_DATA,

This comment was marked as resolved.

// generate hash key
S2CellId leaf_cell_id = S2Cell(latlng).id();
S2CellId parent_cell_id = leaf_cell_id.parent(_min_level);
geo_hash_key = parent_cell_id.ToString(); // [0,5]{1}/[0,3]{_min_level}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个注释没看明白啥意思……

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

正则表达式

}

// scan all cell ids
std::shared_ptr<std::list<std::vector<SearchResult>>> results(

This comment was marked as resolved.

}
};

std::shared_ptr<dsn::task_tracker> tracker(new dsn::task_tracker);

This comment was marked as resolved.

shengofsun
shengofsun previously approved these changes Jul 11, 2018
@@ -1708,19 +1708,22 @@ inline bool copy_data(command_executor *e, shell_context *sc, arguments args)
{"max_split_count", required_argument, 0, 's'},
{"max_batch_count", required_argument, 0, 'b'},
{"timeout_ms", required_argument, 0, 't'},
{"geo_data", optional_argument, 0, 'g'},

This comment was marked as resolved.


optind = 0;
while (true) {
int option_index = 0;
int c;
c = getopt_long(args.argc, args.argv, "c:a:s:b:t:", long_options, &option_index);
c = getopt_long(args.argc, args.argv, "c:a:s:b:t:g:", long_options, &option_index);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

g后面没有冒号,因为是无参的

@acelyc111 acelyc111 merged commit 24fec41 into apache:master Jul 11, 2018
@neverchanje neverchanje added component/geo Pegasus GEO support and removed new feature labels Sep 13, 2018
neverchanje pushed a commit to neverchanje/pegasus that referenced this pull request Jul 13, 2019
* add geo library, support set/del/search_radial/distance APIs
* integrate the library into redis proxy

Former-commit-id: cb41fabdc0711354c7760c0882598ed981a31374 [formerly 24fec41]
Former-commit-id: d97b5f76ee0dc10974d0edcbf57a0d35c9a3e3b3
cauchy1988 pushed a commit to cauchy1988/incubator-pegasus that referenced this pull request May 7, 2022
acelyc111 referenced this pull request in acelyc111/pegasus May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/geo Pegasus GEO support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants