Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: services/flog/flog_directory.h

Issue 2046703002: Add 'flog' service implementation. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fixes per feedback. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « services/flog/BUILD.gn ('k') | services/flog/flog_directory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MOJO_SERVICES_FLOG_FLOG_DIRECTORY_H_
6 #define MOJO_SERVICES_FLOG_FLOG_DIRECTORY_H_
7
8 #include <map>
9
10 #include "mojo/public/cpp/application/connect.h"
11 #include "mojo/services/files/interfaces/directory.mojom.h"
12 #include "mojo/services/files/interfaces/file.mojom.h"
13 #include "mojo/services/files/interfaces/files.mojom.h"
14
15 namespace mojo {
16 namespace flog {
17
18 // Flog directory management.
19 class FlogDirectory {
20 public:
21 using GetExistingFilesCallback =
22 std::function<void(std::unique_ptr<std::map<uint32_t, std::string>>)>;
23
24 FlogDirectory(Shell* shell);
25
26 ~FlogDirectory();
27
28 // Calls back with a map (id -> label) of existing files.
29 void GetExistingFiles(GetExistingFilesCallback callback);
30
31 // Gets a FilePtr for the indicated file.
32 files::FilePtr GetFile(uint32_t id, const std::string& label, bool create);
33
34 private:
35 static const size_t kLogIdWidth = 8;
36
37 // Returns a log file name given the id and label of the log.
38 std::string LogFileName(uint32_t id, const std::string& label);
39
40 // Parses a log file name.
41 bool ParseLogFileName(const std::string& name,
42 uint32_t* id_out,
43 std::string* label_out);
44
45 files::FilesPtr files_;
46 files::DirectoryPtr file_system_;
47 };
48
49 } // namespace flog
50 } // namespace mojo
51
52 #endif // MOJO_SERVICES_FLOG_FLOG_DIRECTORY_H_
OLDNEW
« no previous file with comments | « services/flog/BUILD.gn ('k') | services/flog/flog_directory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698