这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@
.vscode
.idea
.DS_Store

841 changes: 464 additions & 377 deletions Cargo.lock

Large diffs are not rendered by default.

58 changes: 7 additions & 51 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,51 +1,7 @@
[package]
name = "bayard"
version = "0.6.0"
authors = ["Minoru Osuka <minoru.osuka@gmail.com>"]
edition = "2018"
description = "Bayard is a full-text search and indexing server written in Rust."
documentation = "https://bayard-search.github.io/bayard/"
homepage = "https://github.com/bayard-search"
repository = "https://github.com/bayard-search/bayard"
readme = "README.md"
keywords = ["search", "index", "server", "information", "retrieval"]
categories = ["database"]
license = "MIT"
exclude = ["docs", "docs_src", "etc"]

[lib]
name = "bayard"

[[bin]]
name = "bayard"
path = "src/main.rs"

[dependencies]
async-std = "1.4.0"
bayard-client = "0.1.0"
bayard-proto = "0.2.0"
cang-jie = "0.7.0"
clap = "2.33.0"
crossbeam-channel = "0.4.0"
ctrlc = { version = "3.1.3", features = ["termination"] }
env_logger = "0.7.1"
futures = "0.1.29"
grpcio = { version = "0.4.7", features = [ "secure" ] }
iron = "0.6.1"
jieba-rs = "0.4.10"
job_scheduler = "1.1.0"
lindera-tantivy = "0.1.0"
log = "0.4.8"
logger = "0.4.0"
num_cpus = "1.11.1"
persistent = "0.4.0"
prometheus = "0.7.0"
protobuf = "2.10.1"
raft = "0.4.3"
rand = "0.7.2"
router = "0.6.0"
serde = { version = "1.0.104", features = ["derive"] }
serde_json = "1.0.44"
stringreader = "0.1.1"
tantivy = "0.12.0"
urlencoded = "0.6.0"
[workspace]
members = [
"bayard-server",
"bayard-client",
"bayard-rest",
"bayard",
]
24 changes: 13 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG RUST_VERSION=1.39.0
ARG RUST_VERSION=1.42.0


FROM rust:${RUST_VERSION}-slim-stretch AS builder
Expand All @@ -15,23 +15,25 @@ RUN set -ex \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Cache dependencies.
COPY ./Cargo.toml ./Cargo.lock ./
RUN mkdir -p src \
&& echo "fn main() {}" > src/main.rs \
&& touch src/lib.rs \
&& cargo build --release

COPY . ./
RUN make build


FROM debian:stretch-slim

RUN mkdir -p /data
WORKDIR /

RUN set -ex \
&& apt-get update \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p /data

COPY --from=builder /repo/bin /usr/local/bin
COPY --from=builder /repo/etc/* /etc/
EXPOSE 5000

EXPOSE 5000 7000

ENTRYPOINT [ "bayard" ]
CMD [ "serve" ]
CMD [ "start" ]
39 changes: 30 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
BIN_DIR ?= $(CURDIR)/bin
DOCS_DIR ?= $(CURDIR)/docs
VERSION ?=

ifeq ($(VERSION),)
VERSION = $(shell cargo metadata --no-deps --format-version=1 | jq -r '.packages[] | select(.name=="bayard") | .version')
endif
SERVER_VERSION ?= $(shell cargo metadata --no-deps --format-version=1 | jq -r '.packages[] | select(.name=="bayard-server") | .version')
CLIENT_VERSION ?= $(shell cargo metadata --no-deps --format-version=1 | jq -r '.packages[] | select(.name=="bayard-client") | .version')
REST_VERSION ?= $(shell cargo metadata --no-deps --format-version=1 | jq -r '.packages[] | select(.name=="bayard-rest") | .version')
VERSION ?= $(shell cargo metadata --no-deps --format-version=1 | jq -r '.packages[] | select(.name=="bayard") | .version')

.DEFAULT_GOAL := build

Expand All @@ -15,23 +14,45 @@ clean:
format:
cargo fmt

build:
build: format
mkdir -p $(BIN_DIR)
cargo build --release
cp -p ./target/release/bayard $(BIN_DIR)
cp -p ./target/release/bayard-rest $(BIN_DIR)

test:
cargo test

build-docker:
tag:
git tag v$(VERSION)
git push origin v$(VERSION)

publish: format
ifeq ($(shell cargo show --json bayard-server | jq -r '.versions[].num' | grep $(SERVER_VERSION)),)
(cd bayard-server && cargo package && cargo publish)
sleep 10
endif
ifeq ($(shell cargo show --json bayard-client | jq -r '.versions[].num' | grep $(CLIENT_VERSION)),)
(cd bayard-client && cargo package && cargo publish)
sleep 10
endif
ifeq ($(shell cargo show --json bayard-rest | jq -r '.versions[].num' | grep $(REST_VERSION)),)
(cd bayard-rest && cargo package && cargo publish)
sleep 10
endif
ifeq ($(shell cargo show --json bayard-client | jq -r '.versions[].num' | grep $(VERSION)),)
(cd bayard && cargo package && cargo publish)
endif

docker-build:
docker build -t bayardsearch/bayard:latest .
docker tag bayardsearch/bayard:latest bayardsearch/bayard:$(VERSION)

push-docker:
docker-push:
docker push bayardsearch/bayard:latest
docker push bayardsearch/bayard:$(VERSION)

clean-docker:
docker-clean:
docker rmi -f $(shell docker images --filter "dangling=true" -q --no-trunc)

.PHONY: docs
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Join the chat at https://gitter.im/bayard-search/bayard](https://badges.gitter.im/bayard-search/bayard.svg)](https://gitter.im/bayard-search/bayard?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Bayard is a full-text search and indexing server written in [Rust](https://www.rust-lang.org/) built on top of [Tantivy](https://github.com/tantivy-search/tantivy) that implements [The Raft Consensus Algorithm](https://raft.github.io/) ([raft-rs](https://github.com/tikv/raft-rs)) and [The gRPC](https://grpc.io/) ([grpc-rs](https://github.com/tikv/grpc-rs)).
Bayard is a full-text search and indexing server written in [Rust](https://www.rust-lang.org/) built on top of [Tantivy](https://github.com/tantivy-search/tantivy) that implements [Raft Consensus Algorithm](https://raft.github.io/) and [gRPC](https://grpc.io/).
Achieves consensus across all the nodes, ensures every change made to the system is made to a quorum of nodes.
Bayard makes easy for programmers to develop search applications with advanced features and high availability.

Expand Down
25 changes: 25 additions & 0 deletions bayard-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[package]
name = "bayard-client"
version = "0.7.0"
authors = ["Minoru Osuka <minoru.osuka@gmail.com>"]
edition = "2018"
description = "Client library for Bayard."
documentation = "https://bayard-search.github.io/bayard/"
homepage = "https://github.com/bayard-search"
repository = "https://github.com/bayard-search/bayard/bayard-client"
readme = "README.md"
keywords = ["full-text", "search", "index", "client"]
categories = ["database"]
license = "MIT"

[dependencies]
bincode = "1.2.1"
grpcio = { version = "0.4.7", features = [ "secure" ] }
log = "0.4.8"
protobuf = "2.14.0"
raft = "0.4.3"
rand = "0.7.2"
serde_json = "1.0.44"

bayard-proto = "0.7.0"
bayard-server = { version = "0.7.0", path = "../bayard-server" }
8 changes: 8 additions & 0 deletions bayard-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Bayard

[![Join the chat at https://gitter.im/bayard-search/bayard](https://badges.gitter.im/bayard-search/bayard.svg)](https://gitter.im/bayard-search/bayard?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Bayard is a full-text search and indexing server written in [Rust](https://www.rust-lang.org/) built on top of [Tantivy](https://github.com/tantivy-search/tantivy) that implements [Raft Consensus Algorithm](https://raft.github.io/) and [gRPC](https://grpc.io/).
Achieves consensus across all the nodes, ensures every change made to the system is made to a quorum of nodes.
Bayard makes easy for programmers to develop search applications with advanced features and high availability.
Loading