├── cblite
├── cblite.def
├── cbliteTool+sql.cc
├── CMakeLists.txt
├── cbliteTool+encrypt.cc
├── cbliteTool+file.cc
├── cbliteTool+put.cc
└── cbliteTool+revs.cc
├── misc
├── cloc_cbllog.txt
└── cbllog_files.txt
├── .gitignore
├── gen_errors
├── .gitignore
├── java.py
├── README.md
├── android.py
├── gen_errors.py
├── csharp.py
├── objc.py
└── cbl-errors.json
├── LargeDatasetGenerator
├── images
│ ├── relationship.png
│ └── relationship.puml
├── LargeDatasetGenerator.Abstractions
│ ├── LargeDatasetGenerator.Abstractions.csproj
│ ├── IDataGenerator.cs
│ └── IJsonOutput.cs
├── LargeDatasetGenerator.Core
│ ├── LargeDatasetGenerator.Core.csproj
│ ├── Generator
│ │ ├── BoolGenerator.cs
│ │ ├── GuidGenerator.cs
│ │ ├── Extensions.cs
│ │ ├── ThreadSafeRandom.cs
│ │ ├── DataGenerator.cs
│ │ ├── RepeatGeneratorArgs.cs
│ │ ├── PluginLoader.cs
│ │ ├── GeneratorArgumentParser.cs
│ │ ├── DateObjectArgs.cs
│ │ ├── IntegerGenerator.cs
│ │ ├── LoremGenerator.cs
│ │ ├── GaussGenerator.cs
│ │ ├── RandomGenerator.cs
│ │ ├── RangeGenerator.cs
│ │ └── FloatingGenerator.cs
│ ├── Outputs
│ │ └── JsonFileOutput.cs
│ ├── PositionalConsole.cs
│ └── Data
│ │ └── LoremIpsum.cs
├── LargeDatasetGenerator.SyncGateway
│ ├── LargeDatasetGenerator.SyncGateway.csproj
│ ├── UrlValidation.cs
│ └── SyncGatewayOutput.cs
├── LargeDatasetGenerator.CouchbaseServer
│ ├── LargeDatasetGenerator.CouchbaseServer.csproj
│ ├── UrlValidation.cs
│ └── CouchbaseServerOutput.cs
├── LargeDatasetGenerator
│ ├── example.json
│ ├── LargeDatasetGenerator.csproj
│ ├── Program_args.cs
│ └── Program.cs
├── LargeDatasetGenerator.CouchbaseLite
│ ├── LargeDatasetGenerator.CouchbaseLite.csproj
│ └── CouchbaseLiteOutput.cs
├── README.md
├── README_generator.md
├── README_output.md
└── LargeDatasetGenerator.sln
├── ci
├── cbl-log
│ ├── packages
│ │ └── fpm
│ │ │ ├── cbl-log-post-remove.sh
│ │ │ └── Makefile
│ ├── ci-build.ps1
│ ├── ci-build.sh
│ └── CMakeLists.txt
└── cblite
│ ├── ci-build.ps1
│ ├── ci-build.sh
│ └── CMakeLists.txt
├── Xcode
├── Tools.xcodeproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── xcshareddata
│ │ └── xcschemes
│ │ ├── cblite.xcscheme
│ │ ├── cbl-log.xcscheme
│ │ └── Tests.xcscheme
└── xcconfigs
│ ├── Project_Debug.xcconfig
│ ├── Project_Release.xcconfig
│ ├── Project_Debug_EE.xcconfig
│ ├── Project_Release_EE.xcconfig
│ ├── Project.xcconfig
│ ├── linenoise.xcconfig
│ ├── cblite.xcconfig
│ ├── cbl-log.xcconfig
│ └── tests.xcconfig
├── config.h.in
├── .gitmodules
├── cbl-log
├── LogDecoder_stub.cpp
├── CMakeLists.txt
└── cbl-log.cc
├── README.cbl-log.md
├── tests
├── tests_main.cc
└── LibC++Debug.cc
├── litecp
├── JSONEndpoint.hh
├── DirEndpoint.hh
├── RemoteEndpoint.hh
├── RemoteEndpoint.cc
├── Endpoint.cc
├── JSONEndpoint.cc
├── DBEndpoint.hh
├── DirEndpoint.cc
└── Endpoint.hh
├── ArgumentTokenizer.hh
├── appveyor.yml
├── README.md
├── BUILDING.md
├── README.cblite.md
├── ArgumentTokenizer.cc
├── cmake
└── common_setup.cmake
└── Tool.cc
/cblite/cblite.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | c4query_translateN1QL
--------------------------------------------------------------------------------
/misc/cloc_cbllog.txt:
--------------------------------------------------------------------------------
1 | --list-file=misc/cbllog_files.txt --include-lang="C,C++"
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | output/
3 | bin/
4 | obj/
5 | launchSettings.json
6 | *.user
7 | .vs/
--------------------------------------------------------------------------------
/gen_errors/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # Intellij stuff
3 | .idea
4 | *.iml
5 |
6 | # Python stuff
7 | *.pyc
8 | __pycache__
9 |
10 |
--------------------------------------------------------------------------------
/LargeDatasetGenerator/images/relationship.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/couchbase-mobile-tools/master/LargeDatasetGenerator/images/relationship.png
--------------------------------------------------------------------------------
/ci/cbl-log/packages/fpm/cbl-log-post-remove.sh:
--------------------------------------------------------------------------------
1 | # Remove cbl-log directory
2 | if [ -d "/opt/cbl-log" ]; then
3 | rm -rf /opt/cbl-log > /dev/null 2>&1
4 | fi
5 | exit 0
6 |
--------------------------------------------------------------------------------
/Xcode/Tools.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/misc/cbllog_files.txt:
--------------------------------------------------------------------------------
1 | Tool.cc
2 | ArgumentTokenizer.cc
3 | cbl-log/cbl-log.cc
4 | vendor/couchbase-lite-core/LiteCore/Support/LogDecoder.cc
5 | vendor/couchbase-lite-core/LiteCore/Support/LogEncoder.cc
6 | vendor/couchbase-lite-core/LiteCore/tests/LogEncoderTest.cc
7 |
--------------------------------------------------------------------------------
/config.h.in:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #define TOOLS_VERSION_MAJOR @TOOLS_VERSION_MAJOR@
4 | #define TOOLS_VERSION_MINOR @TOOLS_VERSION_MINOR@
5 | #define TOOLS_VERSION @TOOLS_VERSION_MAJOR@.@TOOLS_VERSION_MINOR@.@TOOLS_VERSION_PATCH@
6 | #define TOOLS_VERSION_STRING "@TOOLS_VERSION_STRING@"
--------------------------------------------------------------------------------
/Xcode/xcconfigs/Project_Debug.xcconfig:
--------------------------------------------------------------------------------
1 | //
2 | // Project_Debug.xcconfig
3 | // CBL_C
4 | //
5 | // Created by Jens Alfke on 12/28/18.
6 | // Copyright © 2018 Couchbase. All rights reserved.
7 | //
8 |
9 | #include "Project.xcconfig"
10 | #include "../vendor/couchbase-lite-core/Xcode/xcconfigs/Project_Debug.xcconfig"
11 |
12 |
--------------------------------------------------------------------------------
/Xcode/xcconfigs/Project_Release.xcconfig:
--------------------------------------------------------------------------------
1 | //
2 | // Project.xcconfig
3 | // CBL_C
4 | //
5 | // Created by Jens Alfke on 12/28/18.
6 | // Copyright © 2018 Couchbase. All rights reserved.
7 | //
8 |
9 | #include "Project.xcconfig"
10 | #include "../vendor/couchbase-lite-core/Xcode/xcconfigs/Project_Release.xcconfig"
11 |
12 |
--------------------------------------------------------------------------------
/Xcode/Tools.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Xcode/xcconfigs/Project_Debug_EE.xcconfig:
--------------------------------------------------------------------------------
1 | //
2 | // Project_Debug_EE.xcconfig
3 | // Tools
4 | //
5 | // Created by Jens Alfke on 5/3/19.
6 | // Copyright © 2019 Couchbase. All rights reserved.
7 | //
8 |
9 | #include "Project_Debug.xcconfig"
10 |
11 | GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) COUCHBASE_ENTERPRISE
12 |
--------------------------------------------------------------------------------
/Xcode/xcconfigs/Project_Release_EE.xcconfig:
--------------------------------------------------------------------------------
1 | //
2 | // Project_Release_EE.xcconfig
3 | // Tools
4 | //
5 | // Created by Jens Alfke on 5/3/19.
6 | // Copyright © 2019 Couchbase. All rights reserved.
7 | //
8 |
9 | #include "Project_Release.xcconfig"
10 |
11 | GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) COUCHBASE_ENTERPRISE
12 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "vendor/linenoise-ng"]
2 | path = vendor/linenoise-ng
3 | url = https://github.com/arangodb/linenoise-ng
4 | [submodule "vendor/couchbase-lite-core"]
5 | path = vendor/couchbase-lite-core
6 | url = https://github.com/couchbase/couchbase-lite-core
7 | [submodule "vendor/peg"]
8 | path = vendor/peg
9 | url = https://github.com/snej/peg.git
10 |
--------------------------------------------------------------------------------
/cbl-log/LogDecoder_stub.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // LogDecoder_stub.cpp
3 | //
4 | // Copyright © 2019 Couchbase. All rights reserved.
5 | //
6 |
7 | // Used for Xcode builds only. Since LogDecoder is inside the LiteCore subproject, Xcode won't
8 | // let us add it to the Tools project. So instead, add a new source file that simply includes it.
9 |
10 | #include "LogDecoder.cc"
11 |
--------------------------------------------------------------------------------
/Xcode/xcconfigs/Project.xcconfig:
--------------------------------------------------------------------------------
1 | //
2 | // Project.xcconfig
3 | // CBL_C
4 | //
5 | // Created by Jens Alfke on 12/28/18.
6 | // Copyright © 2018 Couchbase. All rights reserved.
7 | //
8 |
9 | #include "../vendor/couchbase-lite-core/Xcode/xcconfigs/Project.xcconfig"
10 |
11 | LITECORE = $(SRCROOT)/../vendor/couchbase-lite-core
12 | FLEECE = $(LITECORE)/vendor/fleece
13 |
--------------------------------------------------------------------------------
/LargeDatasetGenerator/LargeDatasetGenerator.Abstractions/LargeDatasetGenerator.Abstractions.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Xcode/xcconfigs/linenoise.xcconfig:
--------------------------------------------------------------------------------
1 | //
2 | // linenoise.xcconfig
3 | // cblite
4 | //
5 | // Created by Jens Alfke on 2/12/19.
6 | // Copyright © 2019 Couchbase. All rights reserved.
7 | //
8 |
9 | CLANG_WARN_DOCUMENTATION_COMMENTS = NO
10 | GCC_WARN_64_TO_32_BIT_CONVERSION = NO
11 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO
12 | CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = NO
13 | GCC_WARN_UNINITIALIZED_AUTOS = NO
14 | CLANG_WARN_UNREACHABLE_CODE = NO
15 |
--------------------------------------------------------------------------------
/Xcode/xcconfigs/cblite.xcconfig:
--------------------------------------------------------------------------------
1 | //
2 | // cblite.xcconfig
3 | // cblite
4 | //
5 | // Created by Jens Alfke on 2/12/19.
6 | // Copyright © 2019 Couchbase. All rights reserved.
7 | //
8 |
9 | SDKROOT = macosx
10 | SUPPORTED_PLATFORMS = macosx
11 |
12 | HEADER_SEARCH_PATHS = $(inherited) $(FLEECE)/API $(inherited) $(FLEECE)/Fleece/Support $(LITECORE)/C/include $(LITECORE)/C $(LITECORE)/Replicator $(LITECORE)/LiteCore/Support
13 |
--------------------------------------------------------------------------------
/Xcode/xcconfigs/cbl-log.xcconfig:
--------------------------------------------------------------------------------
1 | //
2 | // cbl-log.xcconfig
3 | // Tools
4 | //
5 | // Created by Jens Alfke on 4/23/19.
6 | // Copyright © 2019 Couchbase. All rights reserved.
7 | //
8 |
9 | SDKROOT = macosx
10 | SUPPORTED_PLATFORMS = macosx
11 |
12 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) CBLTOOL_NO_C_API
13 |
14 | HEADER_SEARCH_PATHS = $(inherited) $(FLEECE)/API $(inherited) $(FLEECE)/Fleece/Support $(LITECORE)/LiteCore/Support
15 |
--------------------------------------------------------------------------------
/Xcode/xcconfigs/tests.xcconfig:
--------------------------------------------------------------------------------
1 | //
2 | // tests.xcconfig
3 | // Tools
4 | //
5 | // Created by Jens Alfke on 4/11/19.
6 | // Copyright © 2019 Couchbase. All rights reserved.
7 | //
8 |
9 | #include "../vendor/couchbase-lite-core/Xcode/xcconfigs/Tests.xcconfig"
10 | #include "cblite.xcconfig"
11 |
12 | ONLY_ACTIVE_ARCH = YES
13 | LLVM_LTO = NO // LTO makes tests very slow to link
14 |
15 | HEADER_SEARCH_PATHS = $(HEADER_SEARCH_PATHS) $(FLEECE)/vendor/catch/
16 |
--------------------------------------------------------------------------------
/README.cbl-log.md:
--------------------------------------------------------------------------------
1 | # The `cbl-log` Tool
2 |
3 | `cbl-log` is a command-line tool for decoding logs generated by LiteCore (or Couchbase Lite).
4 |
5 | For build instructions, see [BUILDING.md](BUILDING.md).
6 |
7 | ## Features
8 |
9 | | Command | Purpose |
10 | |----------------|---------|
11 | | `cbl-log help` | Display help text |
12 | | `cbl-log logcat` | Converts a binary log file to text and writes it to stdout or the given output path |
13 |
14 |
15 |
16 | [This script](https://gist.github.com/pkjvit/ef84a88b6a61b01291638f1c815f4af3) can convert multiple cbllog files at once.
17 |
--------------------------------------------------------------------------------
/LargeDatasetGenerator/LargeDatasetGenerator.Core/LargeDatasetGenerator.Core.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | latest
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/LargeDatasetGenerator/LargeDatasetGenerator.SyncGateway/LargeDatasetGenerator.SyncGateway.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/LargeDatasetGenerator/LargeDatasetGenerator.CouchbaseServer/LargeDatasetGenerator.CouchbaseServer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/ci/cblite/ci-build.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .Description
3 | Builds the cbl-log tool for Windows only on Couchbase build servers (It will technically work for Mac and Linux if the directory
4 | separator characters are flipped from backslash to slash)
5 | #>
6 | $CMakePath = "C:\Program Files\CMake\bin\cmake.exe"
7 |
8 | New-Item -ItemType Directory -Path "$PSScriptRoot\build" -ErrorAction Ignore
9 | Push-Location "$PSScriptRoot\build"
10 |
11 | & "$CMakePath" "$PSScriptRoot\..\..\cblite"
12 | & "$CMakePath" --build . --target cblite --config RelWithDebInfo
13 | & "$CMakePath" --build . --target cblitetest --config RelWithDebInfo
14 |
15 | Pop-Location
16 |
--------------------------------------------------------------------------------
/ci/cbl-log/ci-build.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .Description
3 | Builds the cbl-log tool for Windows only on Couchbase build servers (It will technically work for Mac and Linux if the directory
4 | separator characters are flipped from backslash to slash)
5 | #>
6 | $CMakePath = "C:\Program Files\CMake\bin\cmake.exe"
7 |
8 | New-Item -ItemType Directory -Path "$PSScriptRoot\build" -ErrorAction Ignore
9 | Push-Location "$PSScriptRoot\build"
10 |
11 | & "$CMakePath" "$PSScriptRoot\..\..\cbl-log"
12 | & "$CMakePath" --build . --target cbl-log --config RelWithDebInfo
13 | & "$CMakePath" --build . --target cbl-logtest --config RelWithDebInfo
14 |
15 | Pop-Location
16 |
--------------------------------------------------------------------------------
/LargeDatasetGenerator/LargeDatasetGenerator.SyncGateway/UrlValidation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel.DataAnnotations;
3 | using McMaster.Extensions.CommandLineUtils;
4 | using McMaster.Extensions.CommandLineUtils.Validation;
5 |
6 | namespace LargeDatasetGenerator.SyncGateway
7 | {
8 | internal sealed class UrlValidation : IOptionValidator
9 | {
10 | public ValidationResult GetValidationResult(CommandOption option, ValidationContext context)
11 | {
12 | return Uri.TryCreate(option.Value(), UriKind.Absolute, out var uri)
13 | ? ValidationResult.Success
14 | : new ValidationResult("--url must be a valid URL");
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/ci/cblite/ci-build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | TOP="$( cd "$(dirname "$0")" ; pwd -P )/../.."
4 | pushd $TOP
5 |
6 | CMAKE_DIRECTORY=$1
7 | if [[ -z $CMAKE_DIRECTORY ]]; then
8 | echo "Error: No CMakeLists.txt directory specified, aborting..."
9 | exit 1
10 | fi
11 |
12 | mkdir -p ci/cblite/build
13 | pushd ci/cblite/build
14 | cmake -DCMAKE_BUILD_TYPE=Release $CMAKE_DIRECTORY
15 | make -j8 cblite
16 | make -j8 cblitetest
17 |
18 | make install
19 | INSTALL_PREFIX=`cat CMakeCache.txt| grep CMAKE_INSTALL_PREFIX | cut -f 2 -d '='`
20 |
21 | popd
22 |
23 | if [[ ! -d $TOP/install ]]; then
24 | mkdir -p $TOP/install
25 | fi
26 |
27 | pushd $INSTALL_PREFIX/lib
28 | echo $INSTALL_PREFIX/lib
29 | rm -rf pkgconfig/
30 |
--------------------------------------------------------------------------------
/LargeDatasetGenerator/LargeDatasetGenerator.CouchbaseServer/UrlValidation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel.DataAnnotations;
3 | using McMaster.Extensions.CommandLineUtils;
4 | using McMaster.Extensions.CommandLineUtils.Validation;
5 |
6 | namespace LargeDatasetGenerator.CouchbaseServer
7 | {
8 | internal sealed class UrlValidation : IOptionValidator
9 | {
10 | public ValidationResult GetValidationResult(CommandOption option, ValidationContext context)
11 | {
12 | return Uri.TryCreate(option.Value(), UriKind.Absolute, out var uri)
13 | ? ValidationResult.Success
14 | : new ValidationResult("--url must be a valid URL");
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/ci/cbl-log/ci-build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | TOP="$( cd "$(dirname "$0")" ; pwd -P )/../.."
4 | pushd $TOP
5 |
6 | CMAKE_DIRECTORY=$1
7 | if [[ -z $CMAKE_DIRECTORY ]]; then
8 | echo "Error: No CMakeLists.txt directory specified, aborting..."
9 | exit 1
10 | fi
11 |
12 | mkdir -p ci/cbl-log/build
13 | pushd ci/cbl-log/build
14 | cmake -DCMAKE_BUILD_TYPE=Release $CMAKE_DIRECTORY
15 | make -j8 cbl-log
16 | make -j8 cbl-logtest
17 |
18 | make install
19 | INSTALL_PREFIX=`cat CMakeCache.txt| grep CMAKE_INSTALL_PREFIX | cut -f 2 -d '='`
20 |
21 | popd
22 |
23 | if [[ ! -d $TOP/install ]]; then
24 | mkdir -p $TOP/install
25 | fi
26 |
27 | pushd $INSTALL_PREFIX/lib
28 | echo $INSTALL_PREFIX/lib
29 | rm -rf libicu* pkgconfig/ icu/
30 |
--------------------------------------------------------------------------------
/LargeDatasetGenerator/LargeDatasetGenerator/example.json:
--------------------------------------------------------------------------------
1 | {
2 | "_id": "{{guid()}}",
3 | "traits": {
4 | "eye_color": "{{random('blue', 'brown', 'green', 'hazel', 'gray'}}",
5 | "hair_color": "{{random('blonde', 'brown', 'auburn', 'red', 'gray'}}",
6 | "age": "{{integer(18,65)}}",
7 | "has_driver_license": "{{bool()}}",
8 | "gpa": "{{floating(2.5, 4.0)}}"
9 | },
10 | "children": [
11 | {
12 | "repeat(0, 4)": {
13 | "name": "{{lorem(3, words}}",
14 | "birthday": "{{date(new Date(1974, 1, 1), new Date(2018, 12, 31))}}"
15 | }
16 | }
17 | ],
18 | "address" : {
19 | "line1" : "{{integer(100,999)}} {{lorem(1, word)}} St."
20 | },
21 | "range": "{{range(1, 10)}}",
22 | "description": "{{lorem(3, paragraphs)}}",
23 | "job_performance": "{{gauss()}}",
24 | "constant_answer": 42
25 | }
--------------------------------------------------------------------------------
/LargeDatasetGenerator/LargeDatasetGenerator.Core/Generator/BoolGenerator.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace LargeDatasetGenerator.Generator
4 | {
5 | ///
6 | /// A generator that will randomly generate true or false
7 | ///
8 | public sealed class BoolGenerator : IDataGenerator
9 | {
10 | #region Properties
11 |
12 | ///
13 | public string Description { get; } = "Randomly generates true or false values";
14 |
15 | ///
16 | public string Signature { get; } = "{{bool()}}";
17 |
18 | #endregion
19 |
20 | #region IDataGenerator
21 |
22 | ///
23 | public Task