From 91a9d6f261c4299e83b916b2dca36e3b4bf25b96 Mon Sep 17 00:00:00 2001 From: Gaius Date: Wed, 28 Jun 2023 17:41:38 +0800 Subject: [PATCH] feat: remove cdn examples in grpc Signed-off-by: Gaius --- pkg/rpc/examples/cdnsystem/client/main.go | 76 ----------------------- 1 file changed, 76 deletions(-) delete mode 100644 pkg/rpc/examples/cdnsystem/client/main.go diff --git a/pkg/rpc/examples/cdnsystem/client/main.go b/pkg/rpc/examples/cdnsystem/client/main.go deleted file mode 100644 index 13fdd90dbeb..00000000000 --- a/pkg/rpc/examples/cdnsystem/client/main.go +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2020 The Dragonfly Authors - * - * 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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. - */ - -package main - -import ( - "context" - "fmt" - "sync" - - "d7y.io/dragonfly/v2/internal/dflog/logcore" - "d7y.io/dragonfly/v2/pkg/basic/dfnet" - "d7y.io/dragonfly/v2/pkg/rpc/base" - "d7y.io/dragonfly/v2/pkg/rpc/cdnsystem" - "d7y.io/dragonfly/v2/pkg/rpc/cdnsystem/client" - _ "d7y.io/dragonfly/v2/pkg/rpc/scheduler/server" -) - -func main() { - logcore.InitCdnSystem(true) - c, err := client.GetClientByAddr([]dfnet.NetAddr{ - { - Type: dfnet.TCP, - Addr: "127.0.0.1:8003", - }, - }) - if err != nil { - panic(err) - } - var wg sync.WaitGroup - for i := 0; i < 1; i++ { - wg.Add(1) - go func() { - defer wg.Done() - psc, _ := c.ObtainSeeds(context.TODO(), &cdnsystem.SeedRequest{ - TaskId: "test2", - Url: "https://desktop.docker.com/mac/stable/amd64/Docker.dmg", - UrlMeta: &base.UrlMeta{ - Filter: "", - }, - }) - - //psc, _ := c.ObtainSeeds(context.TODO(), &cdnsystem.SeedRequest{ - // TaskId: idgen.TaskID("https://desktop.docker.com/mac/stable/amd64/Docker.dmg?a=a&b=b&c=c", "a&b", &base.UrlMeta{ - // Digest: "md5", - // Range: "50-1000", - // }, "dragonfly"), - // Url: "https://desktop.docker.com/mac/stable/amd64/Docker.dmg?a=a&b=b&c=c", - // Filter: "a&b", - //}) - for { - piece, err := psc.Recv() - if err != nil { - fmt.Println(err) - break - } - fmt.Println(piece) - } - }() - } - wg.Wait() - fmt.Println("client finish") -}