MCPcopy Create free account
hub / github.com/baidu/EasyFaaS / CreateUnixServerChain

Function CreateUnixServerChain

cmd/funclet/app/server.go:44–81  ·  view source on GitHub ↗
(runOptions *options.FuncletOptions, stopCh <-chan struct{}, finishCh chan struct{})

Source from the content-addressed store, hash-verified

42}
43
44func CreateUnixServerChain(runOptions *options.FuncletOptions, stopCh <-chan struct{}, finishCh chan struct{}) (*genericserver.GenericServer, error) {
45 config := genericserver.NewRecommendedConfig()
46 if err := runOptions.RecommendedOptions.ApplyTo(config); err != nil {
47 return nil, err
48 }
49 s, err := config.Complete().New("minifunclet")
50 if err != nil {
51 return nil, err
52 }
53
54 // funclet needs to prepare the directory for user containers
55 // lift the restrictions of the new file's permissions
56 syscall.Umask(0)
57 f, err := funclet.InitFunclet(runOptions, stopCh, finishCh)
58 if err != nil {
59 return nil, err
60 }
61 socksPath := runOptions.FuncletApiSocks
62 if err := os.RemoveAll(socksPath); err != nil {
63 return nil, err
64 }
65 ln, err := net.Listen("unix", socksPath)
66 if err != nil {
67 return nil, err
68 }
69 if err := os.Chmod(socksPath, os.ModePerm); err != nil {
70 return nil, err
71 }
72 config.SecureServingInfo = &genericserver.SecureServingInfo{
73 Listener: ln,
74 }
75 s, err = config.Complete().New("funclet_unix")
76 if err != nil {
77 return nil, err
78 }
79 f.InstallAPI(s.Handler.GoRestfulContainer)
80 return s, nil
81}

Callers 1

RunFunction · 0.85

Calls 5

InitFuncletFunction · 0.92
NewMethod · 0.80
CompleteMethod · 0.80
InstallAPIMethod · 0.80
ApplyToMethod · 0.45

Tested by

no test coverage detected