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

Unified Diff: services/flog/flog_directory.h

Issue 2046703002: Add 'flog' service implementation. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/flog/BUILD.gn ('k') | services/flog/flog_directory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/flog/flog_directory.h
diff --git a/services/flog/flog_directory.h b/services/flog/flog_directory.h
new file mode 100644
index 0000000000000000000000000000000000000000..cb2b59b042a472f5c6a2053c2b486107f29e3ede
--- /dev/null
+++ b/services/flog/flog_directory.h
@@ -0,0 +1,52 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_SERVICES_FLOG_FLOG_DIRECTORY_H_
+#define MOJO_SERVICES_FLOG_FLOG_DIRECTORY_H_
+
+#include <map>
+
+#include "mojo/public/cpp/application/connect.h"
+#include "mojo/services/files/interfaces/directory.mojom.h"
+#include "mojo/services/files/interfaces/file.mojom.h"
+#include "mojo/services/files/interfaces/files.mojom.h"
+
+namespace mojo {
+namespace flog {
+
+// Flog directory management.
+class FlogDirectory {
+ public:
+ using GetExistingFilesCallback =
+ std::function<void(std::map<uint32_t, std::string>&&)>;
kulakowski 2016/06/13 20:14:26 Style guide still bans rvalue refs outside the mov
+
+ FlogDirectory(Shell* shell);
+
+ ~FlogDirectory();
+
+ // Calls back with a map (id -> label) of existing files.
+ void GetExistingFiles(GetExistingFilesCallback callback);
+
+ // Gets a FilePtr for the indicated file.
+ files::FilePtr GetFile(uint32_t id, const std::string& label, bool create);
+
+ private:
+ static const size_t kLogIdWidth = 8;
+
+ // Returns a log file name given the id and label of the log.
+ std::string LogFileName(uint32_t id, const std::string& label);
+
+ // Parses a log file name.
+ bool ParseLogFileName(const std::string& name,
+ uint32_t* id_out,
+ std::string* label_out);
+
+ files::FilesPtr files_;
+ files::DirectoryPtr file_system_;
+};
+
+} // namespace flog
+} // namespace mojo
+
+#endif // MOJO_SERVICES_FLOG_FLOG_DIRECTORY_H_
« 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