Skip to content

Commit

Permalink
enhance: support syncpeers by service and optimize the merge logic (#…
Browse files Browse the repository at this point in the history
…3637)

* enhance: support syncpeers by service and optimize the merge logic

Signed-off-by: cormick <[email protected]>
  • Loading branch information
CormickKneey authored Nov 29, 2024
1 parent c220a60 commit d0e41b5
Show file tree
Hide file tree
Showing 16 changed files with 543 additions and 112 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
- name: Golangci lint
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8
with:
version: v1.54
args: --verbose
version: v1.62
args: --verbose --timeout=10m

- name: Markdown lint
uses: docker://avtodev/markdown-lint:v1@sha256:6aeedc2f49138ce7a1cd0adffc1b1c0321b841dc2102408967d9301c031949ee
Expand Down
2 changes: 0 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ linters:
enable:
- gci
- gofmt
- golint
- misspell
- govet
- goconst
- deadcode
- gocyclo
- staticcheck
- errcheck
Expand Down
2 changes: 1 addition & 1 deletion client-rs
Submodule client-rs updated 32 files
+1 −1 .github/workflows/ci.yml
+54 −91 Cargo.lock
+13 −14 Cargo.toml
+1 −1 dragonfly-client-backend/Cargo.toml
+0 −274 dragonfly-client-backend/src/hdfs.rs
+40 −73 dragonfly-client-backend/src/http.rs
+19 −57 dragonfly-client-backend/src/lib.rs
+50 −59 dragonfly-client-backend/src/object_storage.rs
+2 −2 dragonfly-client-config/src/dfdaemon.rs
+0 −71 dragonfly-client-init/src/container_runtime/containerd.rs
+0 −51 dragonfly-client-init/src/container_runtime/crio.rs
+24 −19 dragonfly-client-storage/src/content.rs
+31 −29 dragonfly-client-storage/src/lib.rs
+83 −80 dragonfly-client-storage/src/metadata.rs
+20 −18 dragonfly-client-storage/src/storage_engine/rocksdb.rs
+105 −29 dragonfly-client-util/src/http/mod.rs
+2 −2 dragonfly-client/Cargo.toml
+6 −21 dragonfly-client/src/announcer/mod.rs
+7 −28 dragonfly-client/src/bin/dfdaemon/main.rs
+16 −42 dragonfly-client/src/bin/dfget/main.rs
+26 −32 dragonfly-client/src/grpc/dfdaemon_download.rs
+31 −33 dragonfly-client/src/grpc/dfdaemon_upload.rs
+1 −1 dragonfly-client/src/grpc/mod.rs
+11 −11 dragonfly-client/src/grpc/scheduler.rs
+107 −207 dragonfly-client/src/metrics/mod.rs
+31 −13 dragonfly-client/src/proxy/header.rs
+164 −185 dragonfly-client/src/proxy/mod.rs
+21 −14 dragonfly-client/src/resource/persistent_cache_task.rs
+31 −46 dragonfly-client/src/resource/piece.rs
+13 −10 dragonfly-client/src/resource/piece_collector.rs
+75 −68 dragonfly-client/src/resource/task.rs
+2 −3 dragonfly-client/src/tracing/mod.rs
8 changes: 6 additions & 2 deletions manager/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ type SyncPeersConfig struct {

// Timeout is the timeout for syncing peers information from the single scheduler.
Timeout time.Duration `yaml:"timeout" mapstructure:"timeout"`

// BatchSize is the batch size when operating gorm.
BatchSize int `yaml:"batchSize" mapstructure:"batchSize"`
}

type PreheatTLSClientConfig struct {
Expand Down Expand Up @@ -447,8 +450,9 @@ func New() *Config {
TLS: PreheatTLSClientConfig{},
},
SyncPeers: SyncPeersConfig{
Interval: DefaultJobSyncPeersInterval,
Timeout: DefaultJobSyncPeersTimeout,
Interval: DefaultJobSyncPeersInterval,
Timeout: DefaultJobSyncPeersTimeout,
BatchSize: DefaultJobSyncPeersBatchSize,
},
},
ObjectStorage: ObjectStorageConfig{
Expand Down
3 changes: 3 additions & 0 deletions manager/config/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ const (

// DefaultClusterJobRateLimit is default rate limit(requests per second) for job Open API by cluster.
DefaultClusterJobRateLimit = 10

// DefaultJobSyncPeersBatchSize is the default batch size for syncing all peers information from the scheduler.
DefaultJobSyncPeersBatchSize = 500
)

const (
Expand Down
14 changes: 14 additions & 0 deletions manager/handlers/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@ func (h *Handlers) CreateJob(ctx *gin.Context) {
return
}

ctx.JSON(http.StatusOK, job)
case job.SyncPeersJob:
var json types.CreateSyncPeersJobRequest
if err := ctx.ShouldBindBodyWith(&json, binding.JSON); err != nil {
ctx.JSON(http.StatusUnprocessableEntity, gin.H{"errors": err.Error()})
return
}

job, err := h.service.CreateSyncPeersJob(ctx.Request.Context(), json)
if err != nil {
ctx.Error(err) // nolint: errcheck
return
}

ctx.JSON(http.StatusOK, job)
case job.GetTaskJob:
var json types.CreateGetTaskJobRequest
Expand Down
9 changes: 5 additions & 4 deletions manager/job/mocks/sync_peers_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d0e41b5

Please sign in to comment.