NewBrowserService constructs a BrowserService that accesses storage through a set of handles.
(contentAddressableStorage, actionCache, initialSizeClassCache, fileSystemAccessCache blobstore.BlobAccess, maximumMessageSizeBytes int, templates *template.Template, bbClientdInstanceNamePatcher digest.InstanceNamePatcher, router *mux.Router)
| 106 | // NewBrowserService constructs a BrowserService that accesses storage |
| 107 | // through a set of handles. |
| 108 | func NewBrowserService(contentAddressableStorage, actionCache, initialSizeClassCache, fileSystemAccessCache blobstore.BlobAccess, maximumMessageSizeBytes int, templates *template.Template, bbClientdInstanceNamePatcher digest.InstanceNamePatcher, router *mux.Router) *BrowserService { |
| 109 | s := &BrowserService{ |
| 110 | contentAddressableStorage: contentAddressableStorage, |
| 111 | actionCache: actionCache, |
| 112 | initialSizeClassCache: initialSizeClassCache, |
| 113 | fileSystemAccessCache: fileSystemAccessCache, |
| 114 | maximumMessageSizeBytes: maximumMessageSizeBytes, |
| 115 | templates: templates, |
| 116 | bbClientdInstanceNamePatcher: bbClientdInstanceNamePatcher, |
| 117 | } |
| 118 | router.HandleFunc("/", s.handleWelcome) |
| 119 | router.HandleFunc("/{instanceName:(?:.*?/)?}blobs/{digestFunction}/action/{hash}-{sizeBytes}/", s.handleAction) |
| 120 | router.HandleFunc("/{instanceName:(?:.*?/)?}blobs/{digestFunction}/command/{hash}-{sizeBytes}/", s.handleCommand) |
| 121 | router.HandleFunc("/{instanceName:(?:.*?/)?}blobs/{digestFunction}/directory/{hash}-{sizeBytes}/", s.handleDirectory) |
| 122 | router.HandleFunc("/{instanceName:(?:.*?/)?}blobs/{digestFunction}/file/{hash}-{sizeBytes}/{name}", s.handleFile) |
| 123 | router.HandleFunc("/{instanceName:(?:.*?/)?}blobs/{digestFunction}/previous_execution_stats/{hash}-{sizeBytes}/", s.handlePreviousExecutionStats) |
| 124 | router.HandleFunc("/{instanceName:(?:.*?/)?}blobs/{digestFunction}/tree/{hash}-{sizeBytes}/{subdirectory:(?:.*/)?}", s.handleTree) |
| 125 | router.HandleFunc("/{instanceName:(?:.*?/)?}blobs/{digestFunction}/historical_execute_response/{hash}-{sizeBytes}/", s.handleHistoricalExecuteResponse) |
| 126 | return s |
| 127 | } |
| 128 | |
| 129 | var ( |
| 130 | invalidReplacementComponent = path.MustNewComponent("???") |