Skip to content

Commit 7d87af3

Browse files
committed
initial boost service
1 parent 6f24c18 commit 7d87af3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+16644
-0
lines changed

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/boost
2+
extern/filecoin-ffi/rust/target
3+
**/*.a
4+
**/*.pc
5+
/**/*/.DS_STORE
6+
.DS_STORE
7+
build/.*
8+
.idea

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "extern/filecoin-ffi"]
2+
path = extern/filecoin-ffi
3+
url = https://github.com/filecoin-project/filecoin-ffi.git

LICENSE-APACHE

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
2+
3+
http://www.apache.org/licenses/LICENSE-2.0
4+
5+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

LICENSE-MIT

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
The MIT License (MIT)
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

Makefile

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
SHELL=/usr/bin/env bash
2+
3+
all: build
4+
.PHONY: all
5+
6+
unexport GOFLAGS
7+
8+
GOCC?=go
9+
10+
GOVERSION:=$(shell $(GOCC) version | tr ' ' '\n' | grep go1 | sed 's/^go//' | awk -F. '{printf "%d%03d%03d", $$1, $$2, $$3}')
11+
ifeq ($(shell expr $(GOVERSION) \< 1016000), 1)
12+
$(warning Your Golang version is go$(shell expr $(GOVERSION) / 1000000).$(shell expr $(GOVERSION) % 1000000 / 1000).$(shell expr $(GOVERSION) % 1000))
13+
$(error Update Golang to version to at least 1.16.0)
14+
endif
15+
16+
# git modules that need to be loaded
17+
MODULES:=
18+
19+
CLEAN:=
20+
BINS:=
21+
22+
ldflags=-X=github.com/filecoin-project/boost/build.CurrentCommit=+git.$(subst -,.,$(shell git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null || git rev-parse --short HEAD 2>/dev/null))
23+
ifneq ($(strip $(LDFLAGS)),)
24+
ldflags+=-extldflags=$(LDFLAGS)
25+
endif
26+
27+
GOFLAGS+=-ldflags="$(ldflags)"
28+
29+
30+
## FFI
31+
32+
FFI_PATH:=extern/filecoin-ffi/
33+
FFI_DEPS:=.install-filcrypto
34+
FFI_DEPS:=$(addprefix $(FFI_PATH),$(FFI_DEPS))
35+
36+
$(FFI_DEPS): build/.filecoin-install ;
37+
38+
build/.filecoin-install: $(FFI_PATH)
39+
$(MAKE) -C $(FFI_PATH) $(FFI_DEPS:$(FFI_PATH)%=%)
40+
@touch $@
41+
42+
MODULES+=$(FFI_PATH)
43+
BUILD_DEPS+=build/.filecoin-install
44+
CLEAN+=build/.filecoin-install
45+
46+
ffi-version-check:
47+
@[[ "$$(awk '/const Version/{print $$5}' extern/filecoin-ffi/version.go)" -eq 3 ]] || (echo "FFI version mismatch, update submodules"; exit 1)
48+
BUILD_DEPS+=ffi-version-check
49+
50+
.PHONY: ffi-version-check
51+
52+
$(MODULES): build/.update-modules ;
53+
# dummy file that marks the last time modules were updated
54+
build/.update-modules:
55+
git submodule update --init --recursive
56+
touch $@
57+
58+
# end git modules
59+
60+
## MAIN BINARIES
61+
62+
CLEAN+=build/.update-modules
63+
64+
deps: $(BUILD_DEPS)
65+
.PHONY: deps
66+
67+
build-devnets: build lotus-seed lotus-shed lotus-wallet lotus-gateway
68+
.PHONY: build-devnets
69+
70+
boost: $(BUILD_DEPS)
71+
rm -f boost
72+
$(GOCC) build $(GOFLAGS) -o boost ./cmd/boost
73+
.PHONY: boost
74+
BINS+=boost
75+
76+
build: boost
77+
.PHONY: build
78+
79+
install: install-boost
80+
81+
install-boost:
82+
install -C ./boost /usr/local/bin/boost
83+
84+
buildall: $(BINS)
85+
86+
clean:
87+
rm -rf $(CLEAN) $(BINS)
88+
-$(MAKE) -C $(FFI_PATH) clean
89+
.PHONY: clean
90+
91+
dist-clean:
92+
git clean -xdff
93+
git submodule deinit --all -f
94+
.PHONY: dist-clean
95+
96+
gen: cfgdoc-gen api-gen
97+
.PHONY: gen
98+
99+
api-gen:
100+
$(GOCC) run ./gen/api
101+
goimports -w api
102+
goimports -w api
103+
.PHONY: api-gen
104+
105+
cfgdoc-gen:
106+
$(GOCC) run ./node/config/cfgdocgen > ./node/config/doc_gen.go
107+
108+
print-%:
109+
@echo $*=$($*)

api/api.go

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package api
2+
3+
// MODIFYING THE API INTERFACE
4+
//
5+
// When adding / changing methods in this file:
6+
// * Do the change here
7+
// * Adjust implementation in `node/impl/`
8+
// * Run `make gen` - this will:
9+
// * Generate proxy structs
10+
// * Generate mocks
11+
// * Generate markdown docs
12+
// * Generate openrpc blobs
13+
14+
type Boost interface {
15+
Common
16+
Net
17+
}
18+
19+
// DagstoreShardInfo is the serialized form of dagstore.DagstoreShardInfo that
20+
// we expose through JSON-RPC to avoid clients having to depend on the
21+
// dagstore lib.
22+
type DagstoreShardInfo struct {
23+
Key string
24+
State string
25+
Error string
26+
}
27+
28+
// DagstoreShardResult enumerates results per shard.
29+
type DagstoreShardResult struct {
30+
Key string
31+
Success bool
32+
Error string
33+
}
34+
35+
type DagstoreInitializeAllParams struct {
36+
MaxConcurrency int
37+
IncludeSealed bool
38+
}
39+
40+
// DagstoreInitializeAllEvent represents an initialization event.
41+
type DagstoreInitializeAllEvent struct {
42+
Key string
43+
Event string // "start", "end"
44+
Success bool
45+
Error string
46+
Total int
47+
Current int
48+
}

0 commit comments

Comments
 (0)