utils.go 568 B

12345678910111213141516
  1. package bokofs
  2. import "imuslab.com/bokofs/bokofsd/mod/bokofs/bokoworker"
  3. // GetRegisteredRootFolders returns all the registered root folders
  4. // by loaded bokoFS workers. This will be shown when the client
  5. // request the root path (/) of this bokoFS server
  6. func (s *Server) GetRegisteredRootFolders() ([]string, error) {
  7. var rootFolders []string
  8. s.LoadedWorkers.Range(func(key, value interface{}) bool {
  9. thisWorker := value.(*bokoworker.Worker)
  10. rootFolders = append(rootFolders, thisWorker.RootPath)
  11. return true
  12. })
  13. return rootFolders, nil
  14. }