Skip to content

Commit ce2dcb9

Browse files
committed
remove old watcher and external_watcher
1 parent 562a401 commit ce2dcb9

File tree

8 files changed

+7
-1236
lines changed

8 files changed

+7
-1236
lines changed

cmd/backend/app/root.go

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"files/pkg/integration"
1414
"files/pkg/postgres"
1515
"files/pkg/redisutils"
16-
"files/pkg/rpc"
1716
"files/pkg/tasks"
1817
"files/pkg/watchers"
1918
"io"
@@ -170,14 +169,7 @@ user created with the credentials from options "username" and "password".`,
170169
// - CleanupOldFilesAndRedisEntries
171170
InitCrontabs()
172171

173-
// step5: BackgroundTask
174-
// - initRpcServer
175-
// - initWatcher
176-
ctx, cancel := context.WithCancel(context.Background())
177-
defer cancel()
178-
rpc.InitRpcService(ctx)
179-
180-
// step6: run http server
172+
// step5: run http server
181173
server := getRunParams(cmd.Flags())
182174
setupLog(server.Log)
183175

@@ -210,26 +202,26 @@ user created with the credentials from options "username" and "password".`,
210202
checkErr(err)
211203
}
212204

213-
// step7: init commands
205+
// step6: init commands
214206
rclone.NewCommandRclone()
215207
rclone.Command.InitServes()
216208

217-
// step8: build driver handler
209+
// step7: build driver handler
218210
drivers.NewDriverHandler()
219211

220-
// step9: init global
212+
// step8: init global
221213
config := ctrl.GetConfigOrDie()
222214
global.InitGlobalData(config)
223215
global.InitGlobalNodes(config)
224216
global.InitGlobalMounted()
225217

226-
// step10: init seahub (for test now)
218+
// step9: init seahub (for test now)
227219
seaserv.InitSeaRPC()
228220

229-
// step11: integration
221+
// step10: integration
230222
integration.NewIntegrationManager()
231223

232-
// step12: watcher
224+
// step11: watcher
233225
var w = watchers.NewWatchers(context.Background(), config)
234226
watchers.AddToWatchers[corev1.Node](w, global.NodeGVR, global.GlobalNode.Handlerevent())
235227
watchers.AddToWatchers[appsv1.StatefulSet](w, appsv1.SchemeGroupVersion.WithResource("statefulsets"), global.GlobalData.HandlerEvent())

pkg/http/http.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,8 @@ import (
55
"files/pkg/drivers/sync/seahub"
66
"files/pkg/files"
77
"files/pkg/preview"
8-
"files/pkg/rpc"
98
"net/http"
109

11-
"github.com/gin-gonic/gin"
12-
"k8s.io/klog/v2"
13-
1410
"github.com/gorilla/mux"
1511
)
1612

@@ -52,10 +48,6 @@ func NewHandler(
5248
uploader.PathPrefix("/file-uploaded-bytes").Handler(wrapperFilesUploadArgs(fileUploadedBytesHandler)).Methods("GET") // recons done
5349
uploader.PathPrefix("/upload-link/{uid}").Handler(wrapperFilesUploadArgs(fileUploadChunksHandler)).Methods("POST")
5450

55-
//uploader.PathPrefix("/upload-link").Handler(monkey(uploadLinkHandler, "/upload/upload-link")).Methods("GET") // recons done
56-
//uploader.PathPrefix("/file-uploaded-bytes").Handler(monkey(uploadedBytesHandler, "/upload/file-uploaded-bytes")).Methods("GET") // recons done
57-
//uploader.PathPrefix("/upload-link/{uid}").Handler(monkey(uploadChunksHandler, "/upload/upload-link")).Methods("POST") // recons done
58-
5951
api := r.PathPrefix("/api").Subrouter()
6052

6153
api.PathPrefix("/nodes").Handler(common(nodesGetHandler)).Methods("GET")
@@ -98,24 +90,10 @@ func NewHandler(
9890
api.PathPrefix("/smb_history").Handler(monkey(smbHistoryGetHandler, "/api/smb_history")).Methods("GET") // no need to recons
9991
api.PathPrefix("/smb_history").Handler(monkey(smbHistoryPutHandler, "/api/smb_history")).Methods("PUT") // no need to recons
10092
api.PathPrefix("/smb_history").Handler(monkey(smbHistoryDeleteHandler, "/api/smb_history")).Methods("DELETE") // no need to recons
101-
//api.PathPrefix("/smb_history").Handler(monkey(smbHistoryDeleteHandler, "/api/smb_history")).Methods("PATCH") // recons delete this
102-
103-
files := r.PathPrefix("/files").Subrouter()
104-
files.HandleFunc("/healthcheck", ginHandlerAdapter(rpc.RpcEngine))
10593

10694
callback := r.PathPrefix("/callback").Subrouter()
10795
callback.Path("/create").Handler(monkey(seahub.CallbackCreateHandler, "/callback/create")).Methods("POST")
10896
callback.Path("/delete").Handler(monkey(seahub.CallbackDeleteHandler, "/callback/delete")).Methods("POST")
10997

11098
return stripPrefix(server.BaseURL, r), nil
11199
}
112-
113-
func ginHandlerAdapter(ginEngine *gin.Engine) http.HandlerFunc {
114-
return func(w http.ResponseWriter, r *http.Request) {
115-
klog.Infoln("You see me~")
116-
klog.Infoln("request: ", r)
117-
klog.Infoln("request header: ", r.Header)
118-
klog.Infoln("request body: ", r.Body)
119-
ginEngine.ServeHTTP(w, r)
120-
}
121-
}

pkg/rpc/external_watcher.go

Lines changed: 0 additions & 131 deletions
This file was deleted.

0 commit comments

Comments
 (0)