FileSystemDatabaseManagerVersion002.h (3150B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef DOM_FS_PARENT_DATAMODEL_FILESYSTEMDATABASEMANAGERVERSION002_H_ 8 #define DOM_FS_PARENT_DATAMODEL_FILESYSTEMDATABASEMANAGERVERSION002_H_ 9 10 #include "FileSystemDatabaseManagerVersion001.h" 11 12 namespace mozilla::dom::fs::data { 13 14 class FileSystemDatabaseManagerVersion002 15 : public FileSystemDatabaseManagerVersion001 { 16 public: 17 FileSystemDatabaseManagerVersion002( 18 FileSystemDataManager* aDataManager, FileSystemConnection&& aConnection, 19 UniquePtr<FileSystemFileManager>&& aFileManager, 20 const EntryId& aRootEntry) 21 : FileSystemDatabaseManagerVersion001( 22 aDataManager, std::move(aConnection), std::move(aFileManager), 23 aRootEntry) {} 24 25 /* Static to allow use by quota client without instantiation */ 26 static nsresult RescanTrackedUsages( 27 const FileSystemConnection& aConnection, 28 const quota::OriginMetadata& aOriginMetadata); 29 30 /* Static to allow use by quota client without instantiation */ 31 static Result<Usage, QMResult> GetFileUsage( 32 const FileSystemConnection& aConnection); 33 34 nsresult GetFile(const EntryId& aEntryId, const FileId& aFileId, 35 const FileMode& aMode, ContentType& aType, 36 TimeStamp& lastModifiedMilliSeconds, Path& aPath, 37 nsCOMPtr<nsIFile>& aFile) const override; 38 39 Result<EntryId, QMResult> RenameEntry(const FileSystemEntryMetadata& aHandle, 40 const Name& aNewName) override; 41 42 Result<EntryId, QMResult> MoveEntry( 43 const FileSystemEntryMetadata& aHandle, 44 const FileSystemChildMetadata& aNewDesignation) override; 45 46 Result<EntryId, QMResult> GetEntryId( 47 const FileSystemChildMetadata& aHandle) const override; 48 49 Result<EntryId, QMResult> GetEntryId(const FileId& aFileId) const override; 50 51 Result<FileId, QMResult> EnsureFileId(const EntryId& aEntryId) override; 52 53 Result<FileId, QMResult> EnsureTemporaryFileId( 54 const EntryId& aEntryId) override; 55 56 Result<FileId, QMResult> GetFileId(const EntryId& aEntryId) const override; 57 58 nsresult MergeFileId(const EntryId& aEntryId, const FileId& aFileId, 59 bool aAbort) override; 60 61 protected: 62 Result<bool, QMResult> DoesFileIdExist(const FileId& aFileId) const override; 63 64 nsresult RemoveFileId(const FileId& aFileId) override; 65 66 Result<std::pair<nsTArray<FileId>, Usage>, QMResult> 67 FindFilesWithoutDeprecatedLocksUnderEntry( 68 const EntryId& aEntryId) const override; 69 70 Result<nsTArray<std::pair<EntryId, FileId>>, QMResult> 71 FindFileEntriesUnderDirectory(const EntryId& aEntryId) const override; 72 73 Result<Ok, QMResult> DeprecateSharedLocksForDirectory( 74 const FileSystemChildMetadata& aNewDesignation); 75 }; 76 77 } // namespace mozilla::dom::fs::data 78 79 #endif // DOM_FS_PARENT_DATAMODEL_FILESYSTEMDATABASEMANAGERVERSION002_H_