Skip to content

Commit

Permalink
add mirror document
Browse files Browse the repository at this point in the history
  • Loading branch information
kmrmt committed Dec 2, 2024
1 parent 7d7a044 commit df4d79e
Show file tree
Hide file tree
Showing 18 changed files with 1,538 additions and 1,643 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,10 @@ PROTOS_V1 := $(eval PROTOS_V1 := $(filter apis/proto/v1/%.proto,$(PROTOS)))$(PRO
PBGOS = $(PROTOS:apis/proto/%.proto=apis/grpc/%.pb.go)
SWAGGERS = $(PROTOS:apis/proto/%.proto=apis/swagger/%.swagger.json)
PBDOCS = $(ROOTDIR)/apis/docs/v1/docs.md
PROTO_APIS := $(eval PROTO_APIS := $(filter $(ROOTDIR)/apis/proto/v1/vald/%.proto,$(PROTOS)))$(PROTO_APIS)
PROTO_API_DOCS := $(PROTO_APIS:$(ROOTDIR)/apis/proto/v1/vald/%.proto=$(ROOTDIR)/apis/docs/v1/%.md)
PROTO_VALD_APIS := $(eval PROTO_VALD_APIS := $(filter $(ROOTDIR)/apis/proto/v1/vald/%.proto,$(PROTOS)))$(PROTO_VALD_APIS)
PROTO_VALD_API_DOCS := $(PROTO_VALD_APIS:$(ROOTDIR)/apis/proto/v1/vald/%.proto=$(ROOTDIR)/apis/docs/v1/%.md)
PROTO_MIRROR_APIS := $(eval PROTO_MIRROR_APIS := $(filter $(ROOTDIR)/apis/proto/v1/mirror/%.proto,$(PROTOS)))$(PROTO_MIRROR_APIS)
PROTO_MIRROR_API_DOCS := $(PROTO_MIRROR_APIS:$(ROOTDIR)/apis/proto/v1/mirror/%.proto=$(ROOTDIR)/apis/docs/v1/%.md)

LDFLAGS = -static -fPIC -pthread -std=gnu++23 -lstdc++ -lm -z relro -z now -flto=auto -march=native -mtune=native -fno-plt -Ofast -fvisibility=hidden -ffp-contract=fast -fomit-frame-pointer -fmerge-all-constants -funroll-loops -falign-functions=32 -ffunction-sections -fdata-sections

Expand Down
8 changes: 8 additions & 0 deletions Makefile.d/functions.mk
Original file line number Diff line number Diff line change
Expand Up @@ -463,3 +463,11 @@ define gen-deadlink-checker
$$BIN_PATH -path $3 -ignore-path $4 -format $5 $1; \
rm -rf $$BIN_PATH
endef

define gen-api-document
buf generate --template=apis/docs/buf.gen.tmpl.yaml --path $2
cat apis/docs/v1/payload.md.tmpl apis/docs/v1/_doc.md.tmpl > apis/docs/v1/doc.md.tmpl; \
buf generate --template=apis/docs/buf.gen.doc.yaml --path $2; \
mv $(ROOTDIR)/apis/docs/v1/doc.md $1; \
rm apis/docs/v1/*doc.md.tmpl
endef
21 changes: 10 additions & 11 deletions Makefile.d/proto.mk
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,22 @@ proto/gen/code: \

proto/gen/api/docs: \
proto/gen/api/docs/payload \
$(PROTO_API_DOCS)
$(PROTO_VALD_API_DOCS) \
$(PROTO_MIRROR_API_DOCS)

proto/gen/api/docs/payload: $(ROOTDIR)/apis/docs/v1/payload.md.tmpl

$(ROOTDIR)/apis/docs/v1/payload.md.tmpl: $(ROOTDIR)/apis/proto/v1/payload/payload.proto $(ROOTDIR)/apis/docs/v1/payload.tmpl
@$(call green, "generating payload v1...")
buf generate --template=apis/docs/buf.gen.payload.yaml --path apis/proto/v1/payload/payload.proto
@$(call green,"generating payload v1...")
buf generate --template=apis/docs/buf.gen.payload.yaml

$(ROOTDIR)/apis/docs/v1/%.md: $(ROOTDIR)/apis/proto/v1/vald/%.proto $(ROOTDIR)/apis/docs/v1/payload.md.tmpl $(ROOTDIR)/apis/docs/v1/doc.tmpl
@$(call green, "generating documents for API v1...")
buf generate --template=apis/docs/buf.gen.tmpl.yaml --path $(subst $(ROOTDIR)/,,$<)
cat apis/docs/v1/payload.md.tmpl apis/docs/v1/_doc.md.tmpl > apis/docs/v1/doc.md.tmpl
@sleep 1
buf generate --template=apis/docs/buf.gen.doc.yaml
@sleep 1
mv $(ROOTDIR)/apis/docs/v1/doc.md $@
rm apis/docs/v1/*doc.md.tmpl
@$(call green,"generating documents for API v1...")
@$(call gen-api-document,$@,$(subst $(ROOTDIR)/,,$<))

$(ROOTDIR)/apis/docs/v1/mirror.md: $(ROOTDIR)/apis/proto/v1/mirror/mirror.proto $(ROOTDIR)/apis/docs/v1/payload.md.tmpl $(ROOTDIR)/apis/docs/v1/doc.tmpl
@$(call green,"generating documents for API v1...")
@$(call gen-api-document,$@,$(subst $(ROOTDIR)/,,$<))

proto/replace:
find $(ROOTDIR)/apis/grpc/* -name '*.go' | xargs -P$(CORES) sed -i -E "s%google.golang.org/grpc/codes%$(GOPKG)/internal/net/grpc/codes%g"
Expand Down
2 changes: 2 additions & 0 deletions apis/docs/buf.gen.payload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ plugins:
- local: protoc-gen-doc
out: apis/docs/v1
opt: apis/docs/v1/payload.tmpl,payload.md.tmpl
inputs:
- proto_file: apis/proto/v1/payload/payload.proto
15 changes: 4 additions & 11 deletions apis/docs/v1/doc.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,32 +37,25 @@ service {{.Name}} {
```rpc
{{ printf "{{- template \"scheme:%s\" }}\n" .RequestFullType }}
```

{{ printf "{{- template \"field:%s\" }}\n" .RequestFullType }}

{{ printf "{{ template \"field:%s\" }}" .RequestFullType }}
### Output

- the scheme of `{{ .ResponseFullType }}`

```rpc
{{ printf "{{- template \"scheme:%s\" }}\n" .ResponseFullType }}
```

{{ printf "{{ template \"field:%s\" }}\n" .ResponseFullType }}

{{- if hasKey $descs "Status Code" }}
{{ printf "{{ template \"field:%s\" }}" .ResponseFullType }}
{{ if hasKey $descs "Status Code" }}
### Status Code

| code | description |
| :--: | :---------------- |
{{ pluck "Status Code" $descs | first | trim }}

Please refer to [Response Status Code](../status.md) for more details.

{{ end }}

{{- if hasKey $descs "Troubleshooting" }}

{{ if hasKey $descs "Troubleshooting" }}
### Troubleshooting

{{ pluck "Troubleshooting" $descs | first | trim }}
Expand Down
758 changes: 372 additions & 386 deletions apis/docs/v1/filter.md

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions apis/docs/v1/flush.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ Flush RPC is the method to remove all vectors.
- Flush.Request
empty
### Output
- the scheme of `payload.v1.Info.Index.Count`
Expand All @@ -47,12 +46,12 @@ Flush RPC is the method to remove all vectors.

- Info.Index.Count

| field | type | label | description |
| :---------: | :----- | :---- | :--------------------------- |
| stored | uint32 | | The stored index count. |
| uncommitted | uint32 | | The uncommitted index count. |
| indexing | bool | | The indexing index count. |
| saving | bool | | The saving index count. |
| field | type | label | description |
| :---: | :--- | :---- | :---------- |
| stored | uint32 | | The stored index count. |
| uncommitted | uint32 | | The uncommitted index count. |
| indexing | bool | | The indexing index count. |
| saving | bool | | The saving index count. |

### Status Code

Expand All @@ -66,3 +65,4 @@ Flush RPC is the method to remove all vectors.
| 13 | INTERNAL |

Please refer to [Response Status Code](../status.md) for more details.

Loading

0 comments on commit df4d79e

Please sign in to comment.