Skip to content

Commit

Permalink
Sprint 1
Browse files Browse the repository at this point in the history
  • Loading branch information
mrks committed Oct 15, 2019
0 parents commit b76fc40
Show file tree
Hide file tree
Showing 56 changed files with 8,510 additions and 0 deletions.
95 changes: 95 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
# BreakAfterJavaFieldAnnotations: false
# BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
# IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
# JavaScriptQuotes: Leave
# JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: false
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 8
UseTab: Never
...

40 changes: 40 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
obj/*
.DS_STORE
build/*
build-*/*
*.make
Makefile*
coverage
.vscode
benchmark.json
*.sublime-*
.idea
*.xcodeproj
*.xcworkspace
.vscode
*.pyc
console.log
.repl_history
.queryplan.dot
queryplan.png
.lqp*.dot
lqp*.png
compile_times.txt
exported_table_statistics.json
version.hpp
provider.hpp

# Ignore cmake user files
*.txt.user

# Ignore generated TPC{CH} tables.
# Intentionally only for root dir, tests contain csv we check in
/*.csv
/*.csv.meta

# CLion cmake directory
cmake-build-*

# llvm coverage information
default.profdata
default.profraw
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "third_party/googletest"]
path = third_party/googletest
url = https://github.com/google/googletest.git
37 changes: 37 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)

project(OpossumDB)

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.2)
message(FATAL_ERROR "Your GCC version ${CMAKE_CXX_COMPILER_VERSION} is too old.")
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
message(FATAL_ERROR "Your clang version ${CMAKE_CXX_COMPILER_VERSION} is too old.")
endif()
else()
message(WARNING "You are using an unsupported compiler (${CMAKE_CXX_COMPILER_ID})! Compilation has only been tested with Clang and GCC.")
endif()

# Set default build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
endif()

find_package(Boost REQUIRED)

# CMake settings
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) # To allow CMake to locate our Find*.cmake files
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) # Put binaries into root of build tree
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) # Put libraries into their own dir
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=native")

# Include sub-CMakeLists.txt
add_subdirectory(third_party/ EXCLUDE_FROM_ALL)
add_subdirectory(third_party/googletest EXCLUDE_FROM_ALL)
add_subdirectory(src)


# Useful for printing all c++ files in a directory:
# find . -type f -name "*.cpp" -o -name "*.hpp" | cut -c 3- | sort
52 changes: 52 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Contribution Guidelines
Do not commit/push directly to the master branch. Instead, create a feature branch/fork and file a merge request.

# Coding Style
Avoid exception handling. Because Hyrise is not a product, we do not have to recover from errors. Instead, fail loud (i.e., terminate the program) so that developers immediately notice that something is wrong and can fix the problem at its root.

## Formatting
- 2 spaces for indentation
- 120 columns
- Comments above code
- clang_format enforces these rules automatically

## C++ guidelines
- Do not use `new` or `malloc`
- Do not nest namespaces
- Do not import namespaces (`std::`)

- When overriding a `virtual` method, avoid repeating `virtual` and always use `override` or `final`
- Use const (including cbegin() and cend()) whenever possible
- Use [u]int(8|16|32|64)_t instead of `int, long, uint` etc.
- Include in this order: header for implementation file, c system, c++ system, other
- Use smart pointers over c-style pointers
- Use `IS_DEBUG` macro for non-essential checks
- Be specific: `double a = 3.0;` but `float a = 3.0f;`
- Use forward declarations whenever possible to reduce compile time
- We mostly use structs for PODS (plain old data structures). If it has methods, chances are that it is a class.

## Naming Conventions
- Files: lowercase separated by underscores, e.g., abstract_operator.cpp
- Types (classes, structs, enums, typedefs, using): CamelCase starting with uppercase letter, e.g., `BaseSegment`
- Variables: lowercase separated by underscores, e.g., `chunk_size`
- Functions: lowercase separated by underscores, e.g., `get_num_in_tables()`
- Private / proctected members / methods: like variables / functions with leading underscore, e.g., `_get_chunks()`
- Classes that are used only to have a non-templated base class are named `BaseXY` (e.g., BaseSegment), while classes that have multiple differing implementations are named `AbstractXY` (e.g., AbstractOperator)
- Choose descriptive names. Avoid `i`, `j`, etc. in loops.

## Performance Warnings
- Sometimes, we have convenience functions, such as BaseSegment::operator[], or workarounds, such as performing multiple stable sorts instead of a single one. Because these might negatively affect the performance, the user should be warned if a query causes one of these slow paths to be chosen. For this, we have the PerformanceWarning() macro defined in assert.hpp.

## Documentation
- Most documentation should happen in the code or in the beginning of the header file
- More complex documentation, such as an explanation of an algorithm that profits from images, can be put in the Wiki. Please make sure to link the Wiki page in the code - otherwise, no one will find it.

# Review

**Things to look for:**

- Guidelines (see above)
- Is the copy constructor deleted where it makes sense?
- Is the destructor virtual for base classes?
- Are unnecessary copies of heavy elements made? (prefer vector& over vector, but not int& over int)
- Did the author update documentation and dependencies (Wiki, README.md, DEPENDENCIES.md, Dockerfile, install.sh, Jenkinsfile)
18 changes: 18 additions & 0 deletions DEPENDENCIES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Dependencies

| Name | Version | Platform | Optional |
| ---------------- | ------------- | -------- | ----------------------- |
| build-essential | any | Linux | No |
| boost | >= 1.63.0 | All | No |
| clang | >= 4 | All | Yes, if gcc installed |
| clang-format | 3.8 | All | Yes (formatting) |
| cmake | 3.5 | All | No |
| gcc | 7.2 | All | Yes, if clang installed |
| gcovr | >= 3.2 | All | Yes (coverage) |
| llvm | any | All | Yes (code sanitizers) |
| parallel | any | All | Yes |
| python | >= 2.7 && < 3 | All | Yes (linting) |


## Dependencies that are integrated in our build process via git submodules
- googletest (https://github.com/google/googletest)
62 changes: 62 additions & 0 deletions Docker-Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# https://github.com/Miroka96/docker-makefile

NAME = hyrise/opossum
TAG = 1.0

VOLUME = ${PWD}
MOUNTPATH = /project

#LOCALPORT = 8080
#CONTAINERPORT = 80

# if you want a special image name, edit this
IMAGE = $(NAME):$(TAG)

# if you have no volume, delete the right part
VOLUMEMOUNTING = -v $(VOLUME):$(MOUNTPATH)

# if you publish no ports, delete the right part
PORTPUBLISHING = #-p $(LOCALPORT):$(CONTAINERPORT)

.PHONY: build test test-shell build-test deploy build-deploy undeploy redeploy build-redeploy clean-volume clean clean install-dependencies configure

build:
docker build -t $(IMAGE) .

build-nocache:
docker build -t $(IMAGE) --no-cache .

test:
docker run $(VOLUMEMOUNTING) $(PORTPUBLISHING) --rm $(IMAGE)

test-shell:
docker run -it $(VOLUMEMOUNTING) $(PORTPUBLISHING) --rm $(IMAGE) /bin/bash

build-test: build test

deploy:
docker run --detach --restart always --name=$(NAME) $(VOLUMEMOUNTING) $(PORTPUBLISHING) $(IMAGE)

build-deploy: build deploy

undeploy:
-docker stop $(NAME)
docker rm $(NAME)

redeploy: undeploy deploy

build-redeploy: build redeploy

clean-volume:
-docker volume rm $(VOLUME)

clean:
-docker rm $(NAME)

clean: clean-volume clean

install-dependencies:
echo No dependencies yet

configure:
echo No configuration yet
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM ubuntu:16.04
MAINTAINER Mirko Krause <[email protected]>

RUN mkdir /project

COPY . /project

WORKDIR /project

ENV OPOSSUM_HEADLESS_SETUP true
RUN apt-get update \
&& apt-get install -y \
sudo \
software-properties-common \
&& add-apt-repository -y ppa:git-core/ppa \
&& apt-get update \
&& apt-get install -y git \
&& chmod +x install.sh #\
&& ./install.sh \
&& rm -rf /var/lib/apt/lists/*

VOLUME /project

CMD echo give me a command
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2016-2017 Hasso-Plattner-Institut

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit b76fc40

Please sign in to comment.