ralphchung / 499-chengyuc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Project Chirp


Vagrantfile

You can check out the file in the root directory.

Environemnt

  • Box: "ubuntu/bionic64"
  • OS: Ubuntu 18.04 LTS
  • Provision: N/A

Setup steps

Note: You can either follow the steps below or run the shell script setup.sh in the root directory (This script requires root permission).

Basic tools

$ [sudo] apt update
$ [sudo] apt install gcc g++ make

gRPC

Dependency

$ [sudo] apt install build-essential autoconf libtool pkg-config

Clone the gRPC repository (including submodules)

$ git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc ~/grpc
$ cd ~/grpc
$ git submodule update --init

Make and install gRPC

$ make
$ [sudo] make install

Protoc

$ cd ~/grpc/third_party/protobuf
$ [sudo] make install

gflags

Installation

$ [sudo] apt install libgflags-dev

gtest

Installation

$ [sudo] apt install libgtest-dev cmake
$ cd /usr/src/gtest
$ [sudo] cmake CMakeLists.txt
$ [sudo] make
$ [sudo] cp *.a /usr/lib

glog

Installation

$ [sudo] apt install libgoogle-glog-dev

Compilation instructions

Backend Key-Value Store

Server

$ make backend_server
$ ./backend_server

Unit test

$ make backend_test
$ ./backend_test

Service layer

Server

$ make service_server
$ ./service_server

Unit Test

$ make service_test
$ ./service_test

Command-line tool

Tool

$ make command_line_tool
$ ./chirp

Logging

This program uses glog to log. All the logging will be stored in the folder ./log. If this folder does not exist, give the following command

$ make check_log_folder

Basic example usage

Usage

./chirp operations <arguments> [options arguments]

Operations:
  --register <username>
  --chirp <chirp text>
  --follow <username>
  --read <chirp id>
  --monitor

Options:
  --user <username>
  --reply <reply chirp id>

Examples

Register a user

$ ./chirp --register user

Post a chirp as a user

$ ./chirp --chirp text --user user

Post chirp with tag(s):
Tags start with a "#", don't require space before the "#", must be followed by one or more spaces unless at the end of content. "#tagone#tagtwo" will be recognized as one tag with content "tagone#tagtwo".

Read a chirp with id 1

$ ./chirp --read 1

Reply a chirp with id 1

$ ./chirp --chirp text --user user --reply 1

Follow a user

$ ./chirp --follow another_user --user user

Monitor as user

$ ./chirp --monitor --user user

Stream (don't require login as a registered user)

$ ./chirp --stream "#tagtext"

Shouldn't include any space between ""

About


Languages

Language:C++ 94.4%Language:Makefile 5.1%Language:Shell 0.5%