Giter VIP home page Giter VIP logo

smyte-db's Introduction

smyte-db

This repo is the central build environment for all Smyte C++ projects. For documentation, issues, and code for the submodules in this project, please see each project's individual repo:

Smyte's C++ development is based on facebook's folly and wangle libraries to build high performance servers. The build system uses Google's bazel. By default, it builds a single executable binary that can be deployed to production directly.

Setup

  • Install bazel, libssl-dev, and libatomic1.
  • Ensure submodules are up-to-date: git submodule update --init.
  • Build a project: bazel clean && bazel build ratelimit. The first build may take a while to fetch all the third-party dependencies and build static libraries.

Style guide

Follow Google's C++ style guide with a few exceptions:

  • Using C++ exception is allowed because both folly and wangle use it extensively.
  • Each line can have up to 120 characters instead of 80. Google sticks with 80 for historical reasons, but we have much wider screens now.
  • Method names use camel case, which starts with a lower case letter, e.g., foo.addBack(), instead of pascal case, which starts with a capital letter, e.g., foo.AddBack(). The main reason is that both folly and wangle use camel case, and we want to be consistent. Note that rocksdb uses pascal case because it is derived from Google's leveldb code. While we also use rocksdb heavily, we only use it as a library as supposed to involving it in the inheritance hierarchy.
  • Use cpplint to check for style violations. We use the following config:
  --filter=-legal/copyright,-build/c++11,
  --linelength=120,
  • Name files using camel case and local variables using pascal case for the same reason.
  • Use .cpp instead of .cc as extension for C++ souce code files. There is really no difference between the two. Google uses .cc, and its build rule is also called cc_binary for example. But we'd rather be consistent with the main facebook C++ libraries.
  • Use Clang Format to format your source code with the following config:
  BasedOnStyle: Google
  ColumnLimit: 119
  DerivePointerAlignment: false
  PointerAlignment: Left
  AccessModifierOffset: -1

Test

To run all tests, simply execute bazel test //...:all.

smyte-db's People

Contributors

qix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

smyte-db's Issues

Unable to build: Error: no native function or rule 'new_http_archive'

Thanks a lot for your code contributions. We're trying to evaluate the 'ratelimit' server, but are unable to build. We're getting the following:

$ bazel clean && bazel build ratelimit
Starting local Bazel server and connecting to it...
INFO: Starting clean (this may take a while). Consider using --async if the clean takes more than several minutes.
ERROR: Traceback (most recent call last):
File "/home/tolj/src/ratelimit/smyte-db/WORKSPACE", line 4, column 16, in
smyte_workspace("")
File "/home/tolj/src/ratelimit/smyte-db/third_party/workspace.bzl", line 6, column 11, in smyte_workspace
native.new_http_archive(
Error: no native function or rule 'new_http_archive'
Available attributes: aar_import, action_listener, alias, android_binary, android_device, android_device_script_fixture, android_host_service_fixture, android_instrumentation_test, android_library, android_local_test, android_ndk_repository, android_sdk, android_sdk_repository, android_tools_defaults_jar, apple_binary, apple_cc_toolchain, apple_static_library, available_xcodes, bazel_version, bind, cc_binary, cc_host_toolchain_alias, cc_import, cc_libc_top_alias, cc_library, cc_proto_library, cc_test, cc_toolchain, cc_toolchain_alias, cc_toolchain_suite, config_feature_flag, config_setting, constraint_setting, constraint_value, environment, existing_rule, existing_rules, exports_files, extra_action, fdo_prefetch_hints, fdo_profile, filegroup, genquery, genrule, glob, j2objc_library, java_binary, java_import, java_library, java_lite_proto_library, java_package_configuration, java_plugin, java_proto_library, java_runtime, java_runtime_alias, java_test, java_toolchain, java_toolchain_alias, label_flag, label_setting, local_config_platform, local_repository, new_local_repository, ninja_build, ninja_graph, objc_import, objc_library, package_group, package_name, platform, proto_lang_toolchain, proto_library, py_binary, py_library, py_runtime, py_test, register_execution_platforms, register_toolchains, repository_name, sh_binary, sh_library, sh_test, test_suite, toolchain, toolchain_type, xcode_config, xcode_config_alias, xcode_version
ERROR: error loading package 'external': Package 'external' contains errors
INFO: Elapsed time: 3.628s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)

on ubuntu-18 and

$ bazel version
Build label: 3.5.0
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Wed Sep 2 20:11:46 2020 (1599077506)
Build timestamp: 1599077506
Build timestamp as int: 1599077506

It seems that the 'new_http_archive' has been deprecated for some time by bazel. Since we're no experts in bazel, is there any chance you can update the build environment to fit the latest bazel release?

Thanks.
Stipe

ERROR: build ratelimit failed

Hi,

I build like Setup section but have an error like this.

.
.
.
INFO: SHA256 (https://github.com/google/protobuf/archive/v3.4.1.tar.gz) = 8e0236242106e680b4f9f576cc44b8cd711e948b20a9fc07769b0a20ceab9cc4

INFO: SHA256 (https://github.com/civetweb/civetweb/archive/85424a4.tar.gz) = 00295dda3b6cd8c87f068b7f58464fa9fc35d26c846162b73a01fa895bd42525

ERROR: ...ratelimit/smyte-db/third_party/workspace.bzl:66:5: no such package '@civetweb_git//': Prefix civetweb-85424a4 was given, but not found in the archive and referenced by '//external:civetweb'

ERROR: Analysis of target '//ratelimit:ratelimit' failed; build aborted: Loading failed

Can anyone help me ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.