Skip to content

Conversation

sagar0
Copy link
Contributor

@sagar0 sagar0 commented Nov 20, 2015

This is to address #44 , to support pingserver and redis.

But this also has the undesirable side-effect of duplicating the code in:

  • twemcache/worker_helper.c and slimcache/worker_helper.c
  • twemcache/admin_helper.c and slimcache/admin_helper.c

reply_destroy(&rep);
}

done:
Copy link
Contributor

Choose a reason for hiding this comment

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

no space before label? same below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed label indentation.

@seppo0010
Copy link
Contributor

I don't know about you, but I feel I just read the same code four times. 😿

@sagar0
Copy link
Contributor Author

sagar0 commented Nov 20, 2015

That's right :(. I think I just doubled the already duplicate code. Let me
see how to remove redundancy in admin.c and worker.c, though it is
tangential to the current problem that I am trying to solve.

On Thursday, November 19, 2015, Sebastian Waisbrot notifications@github.com
wrote:

I don't know about you, but I feel I just read the same code four times. [image:
😿]


Reply to this email directly or view it on GitHub
#45 (comment).

@sagar0
Copy link
Contributor Author

sagar0 commented Nov 20, 2015

What do you think about creating a directory common to twemcache and slimcache and moving worker_helper.c and admin_helper.c there, to reduce code-duplication? I believe we will run into more such instances of refactoring once we start adding redis.

I will work on reducing the code duplication in worker.c and admin.c in another pull request.

@seppo0010
Copy link
Contributor

That's fine by me, but check with @thinkingfish

@sagar0
Copy link
Contributor Author

sagar0 commented Nov 21, 2015

Created issue #46 to investigate reducing some duplicate code b/w core/worker and core/admin modules.

@@ -2,6 +2,7 @@ add_subdirectory(core ${PROJECT_BINARY_DIR}/core)
add_subdirectory(protocol ${PROJECT_BINARY_DIR}/protocol)
add_subdirectory(storage ${PROJECT_BINARY_DIR}/storage)
add_subdirectory(time ${PROJECT_BINARY_DIR}/time)
add_subdirectory(twemcache_shared ${PROJECT_BINARY_DIR}/twemcache_shared)

This comment was marked as spam.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

+1 to your comment about including stream primitives. Let me know if you can find a simple and better way. I couldn't come up with one in the short time that I spent on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@thinkingfish btw, the main reason for this pull request is mentioned in issue #44, if you haven't already seen it.

Copy link
Contributor

Choose a reason for hiding this comment

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

do you mean "memcache shared" instead of twemcache?
if so, should this be under protocol/memcache?

@thinkingfish

This comment was marked as spam.

@@ -185,7 +117,7 @@ _admin_event_read(struct buf_sock *s)
_tcp_accept(s);
} else if (c->level == CHANNEL_BASE) {
_admin_read(s);
_admin_post_read(s);
admin_post_read(s);
Copy link
Contributor

Choose a reason for hiding this comment

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

does this compile? I don't see how admin.c would know about admin_post_read since you moved it to another .c file and haven't added any headers

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it does, with an implicit declaration generation.
I did think about adding a header file, but later thought it might be too much for just 1 function per file.

@sagar0 sagar0 closed this Mar 9, 2016
michalbiesek added a commit to michalbiesek/pelikan that referenced this pull request Jul 17, 2019
…basic

slab metrics unit test: test_metrics_insert_basic
swlynch99 pushed a commit to swlynch99/pelikan-twitter that referenced this pull request Sep 30, 2019
GerHobbelt pushed a commit to GerHobbelt/pelikan that referenced this pull request May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants