/*
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#pragma once
#include
#include "ncm_content_meta_database_impl_base.hpp"
namespace ams::ncm {
class ContentMetaDatabaseImpl : public ContentMetaDatabaseImplBase {
public:
ContentMetaDatabaseImpl(ContentMetaKeyValueStore *kvs, const char *mount_name) : ContentMetaDatabaseImplBase(kvs, mount_name) { /* ... */ }
ContentMetaDatabaseImpl(ContentMetaKeyValueStore *kvs) : ContentMetaDatabaseImplBase(kvs) { /* ... */ }
private:
/* Helpers. */
Result GetContentIdImpl(ContentId *out, const ContentMetaKey &key, ContentType type, std::optional id_offset) const;
public:
/* Actual commands. */
virtual Result Set(const ContentMetaKey &key, sf::InBuffer value) override;
virtual Result Get(sf::Out out_size, const ContentMetaKey &key, sf::OutBuffer out_value) override;
virtual Result Remove(const ContentMetaKey &key) override;
virtual Result GetContentIdByType(sf::Out out_content_id, const ContentMetaKey &key, ContentType type) override;
virtual Result ListContentInfo(sf::Out out_entries_written, const sf::OutArray &out_info, const ContentMetaKey &key, s32 offset) override;
virtual Result List(sf::Out out_entries_total, sf::Out out_entries_written, const sf::OutArray &out_info, ContentMetaType meta_type, ApplicationId application_id, u64 min, u64 max, ContentInstallType install_type) override;
virtual Result GetLatestContentMetaKey(sf::Out out_key, u64 id) override;
virtual Result ListApplication(sf::Out out_entries_total, sf::Out out_entries_written, const sf::OutArray &out_keys, ContentMetaType meta_type) override;
virtual Result Has(sf::Out out, const ContentMetaKey &key) override;
virtual Result HasAll(sf::Out out, const sf::InArray &keys) override;
virtual Result GetSize(sf::Out out_size, const ContentMetaKey &key) override;
virtual Result GetRequiredSystemVersion(sf::Out out_version, const ContentMetaKey &key) override;
virtual Result GetPatchId(sf::Out out_patch_id, const ContentMetaKey &key) override;
virtual Result DisableForcibly() override;
virtual Result LookupOrphanContent(const sf::OutArray &out_orphaned, const sf::InArray &content_ids) override;
virtual Result Commit() override;
virtual Result HasContent(sf::Out out, const ContentMetaKey &key, const ContentId &content_id) override;
virtual Result ListContentMetaInfo(sf::Out out_entries_written, const sf::OutArray &out_meta_info, const ContentMetaKey &key, s32 offset) override;
virtual Result GetAttributes(sf::Out out_attributes, const ContentMetaKey &key) override;
virtual Result GetRequiredApplicationVersion(sf::Out out_version, const ContentMetaKey &key) override;
virtual Result GetContentIdByTypeAndIdOffset(sf::Out out_content_id, const ContentMetaKey &key, ContentType type, u8 id_offset) override;
virtual Result GetCount(sf::Out out_count) override;
virtual Result GetOwnerApplicationId(sf::Out out_id, const ContentMetaKey &key) override;
};
}