Skip to content

Commit

Permalink
Merge pull request #70 from RealFax/dev
Browse files Browse the repository at this point in the history
feat. more features
  • Loading branch information
PotatoCloud authored Jan 30, 2024
2 parents 8b667e8 + e5309f2 commit e9d1c47
Show file tree
Hide file tree
Showing 89 changed files with 1,878 additions and 1,339 deletions.
24 changes: 22 additions & 2 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,26 @@ env:
IMAGE_NAME: ${{ github.repository }}

jobs:
init-env:
runs-on: ubuntu-latest

steps:
- name: Checkout master
uses: actions/checkout@master

- name: Declare some variables
shell: bash
run: |
echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> "$GITHUB_ENV"
echo "build_ts=$(date +%s)" >> "$GITHUB_ENV"
- name: "build env double check"
run: |
echo "Branch: ${{ env.branch }}"
echo "Short hash: ${{ env.sha_short }}"
echo "Build timestamp: ${{ env.build_ts }}"
build-oci-image:
runs-on: ubuntu-latest

Expand Down Expand Up @@ -50,8 +70,8 @@ jobs:

- name: Making RedQueen docker image
run: |
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o ./release/rqd ./cmd/rqd
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o ./release/rqctl ./cmd/rqctl
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build --tags=safety_map -ldflags "-s -w -X 'github.com/RealFax/RedQueen/internal/version.BuildTime=${{ env.build_ts }}' -X 'github.com/RealFax/RedQueen/internal/version.BuildVersion=${{ env.sha_short }}'" -o ./release/rqd ./cmd/rqd
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-s -w -X 'github.com/RealFax/RedQueen/internal/version.BuildTime=${{ env.build_ts }}' -X 'github.com/RealFax/RedQueen/internal/version.BuildVersion=${{ env.sha_short }}'" -o ./release/rqctl ./cmd/rqctl
cp ./Dockerfile ./release/Dockerfile
# docker hub credentials
Expand Down
28 changes: 24 additions & 4 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,27 @@ on:
- created

jobs:
build:
init-env:
runs-on: ubuntu-latest

steps:
- name: Checkout master
uses: actions/checkout@master

- name: Declare some variables
shell: bash
run: |
echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> "$GITHUB_ENV"
echo "build_ts=$(date +%s)" >> "$GITHUB_ENV"
- name: "build env double check"
run: |
echo "Branch: ${{ env.branch }}"
echo "Short hash: ${{ env.sha_short }}"
echo "Build timestamp: ${{ env.build_ts }}"
build-rqd:
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -44,7 +64,7 @@ jobs:
go-version: '1.21'

- name: Making RedQueen ${{ matrix.goos }}/${{ matrix.goarch }}
run: go build -o rqd.${{ matrix.goos }}.${{ matrix.goarch }} ./cmd/rqd/main.go
run: go build --tags=safety_map -ldflags "-s -w -X 'github.com/RealFax/RedQueen/internal/version.BuildTime=${{ env.build_ts }}' -X 'github.com/RealFax/RedQueen/internal/version.BuildVersion=${{ env.sha_short }}'" -o rqd.${{ matrix.goos }}.${{ matrix.goarch }} ./cmd/rqd/main.go
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
Expand Down Expand Up @@ -98,8 +118,8 @@ jobs:
with:
go-version: '1.21'

- name: Making RedQueen ${{ matrix.goos }}/${{ matrix.goarch }}
run: go build -o rqctl.${{ matrix.goos }}.${{ matrix.goarch }} ./cmd/rqctl
- name: Making rqctl ${{ matrix.goos }}/${{ matrix.goarch }}
run: go build -ldflags "-s -w -X 'github.com/RealFax/RedQueen/internal/version.BuildTime=${{ env.build_ts }}' -X 'github.com/RealFax/RedQueen/internal/version.BuildVersion=${{ env.sha_short }}'" -o rqctl.${{ matrix.goos }}.${{ matrix.goarch }} ./cmd/rqctl
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ go.work

.idea

.DS_Store
.DS_Store

release/
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ _Inspired by the supercomputer (Red Queen) in "Resident Evil", the distributed k
This is a reliable distributed key-value store based on the raft algorithm, and internal provides advanced functions such as distributed-lock...

## Client call
`# go get github.com/RealFax/RedQueen@latest`
```
go get github.com/RealFax/RedQueen@latest
```

[Code example](https://github.com/RealFax/RedQueen/tree/master/client/example)

Expand Down
4 changes: 3 additions & 1 deletion README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ _灵感来源于《生化危机》中的超级计算机(Red Queen), 分布式key
这是一个基于raft算法实现的可靠分布式key-value存储, 并在内部提供了诸如 分布式锁...之类的高级功能

## 客户端调用
`# go get github.com/RealFax/RedQueen@latest`
```
go get github.com/RealFax/RedQueen@latest
```

[代码示例](https://github.com/RealFax/RedQueen/tree/master/client/example)

Expand Down
5 changes: 0 additions & 5 deletions api/serverpb/Makefile

This file was deleted.

3 changes: 3 additions & 0 deletions api/serverpb/rpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ option go_package = "./;serverpb";


// --------------- Public --------------- //

message ResponseHeader {
// cluster_id is the ID of the cluster which sent the response.
string cluster_id = 1;
Expand All @@ -18,6 +19,7 @@ message ResponseHeader {
}

// --------------- KV store --------------- //

message SetRequest {
// key is the key, in bytes, to set into the key-value store.
bytes key = 1;
Expand Down Expand Up @@ -127,6 +129,7 @@ service KV {
}

// --------------- Locker --------------- //

message LockRequest {
string lock_id = 1;
// ttl indicates the ttl time of this key-value store.
Expand Down
157 changes: 0 additions & 157 deletions api/versionpb/version.pb.go

This file was deleted.

23 changes: 0 additions & 23 deletions api/versionpb/version.proto

This file was deleted.

8 changes: 8 additions & 0 deletions build/build.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.PHONY: all build
all: build

git_hash = $(shell git rev-parse --short HEAD)
build_ts = $(shell date +%s)

build:
go build --tags=safety_map -ldflags "-s -w -X 'github.com/RealFax/RedQueen/internal/version.BuildTime=$(build_ts)' -X 'github.com/RealFax/RedQueen/internal/version.BuildVersion=$(git_hash)'" -o ./release/rqd ./cmd/rqd/main.go
31 changes: 0 additions & 31 deletions client/r_kv_test.go

This file was deleted.

13 changes: 0 additions & 13 deletions client/var.go

This file was deleted.

2 changes: 1 addition & 1 deletion cmd/rqctl/handler_node.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"github.com/RealFax/RedQueen/client"
"github.com/RealFax/RedQueen/pkg/client"
"github.com/urfave/cli/v2"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
Expand Down
Loading

0 comments on commit e9d1c47

Please sign in to comment.