载入中...
搜索中...
未找到
EvpackRange.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
10#include "asset/Evpack.h"
11
12#include <filesystem>
13#include <memory>
14
15namespace eve::asset {
16
19public:
21 virtual ~EvpackRangeSource() = default;
22
24 [[nodiscard]] virtual Result<std::uint64_t> size() const = 0;
25
31 [[nodiscard]] virtual Result<std::vector<std::uint8_t>> read(
32 std::uint64_t offset, std::uint64_t size) const = 0;
33};
34
37public:
39 explicit FileEvpackRangeSource(std::filesystem::path path) : path_(std::move(path)) {}
41 [[nodiscard]] Result<std::uint64_t> size() const override;
44 std::uint64_t offset, std::uint64_t size) const override;
45private:
46 std::filesystem::path path_;
47};
48
54public:
56 [[nodiscard]] const Evpack& index() const noexcept { return index_; }
57
59 [[nodiscard]] Result<std::vector<std::uint8_t>> readChunk(std::size_t index) const;
60
61private:
63 std::shared_ptr<const EvpackRangeSource>, const EvpackLimits&, const EvpackTrust&);
64 EvpackRangeMount(std::shared_ptr<const EvpackRangeSource> source, Evpack index,
66 : source_(std::move(source)), index_(std::move(index)), limits_(limits) {}
67 std::shared_ptr<const EvpackRangeSource> source_;
68 Evpack index_;
69 EvpackLimits limits_;
70};
71
78[[nodiscard]] EVENGINE_API_FOUNDATION Result<EvpackRangeMount> prepareEvpackRangeMount(
79 std::shared_ptr<const EvpackRangeSource> source, const EvpackLimits& limits = {}, const EvpackTrust& trust = {});
80
81} // namespace eve::asset
Versioned random-access runtime package produced by the asset cooker.
#define EVENGINE_API_FOUNDATION
每个链接组(link group)各自的导出宏。
Definition Export.h:106
size_t offset
std::string path
Definition PlayHost.cpp:110
uint32_t index
const UnitySourceAsset & source
const AssetImportLimits & limits
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Admitted metadata plus an immutable range source retained by shared ownership.
Definition EvpackRange.h:53
const Evpack & index() const noexcept
Verified package metadata and random-access TOC.
Definition EvpackRange.h:56
Abstract immutable byte-range provider for files, mmap, HTTP or object storage.
Definition EvpackRange.h:18
virtual Result< std::vector< std::uint8_t > > read(std::uint64_t offset, std::uint64_t size) const =0
Read exactly one validated range.
virtual Result< std::uint64_t > size() const =0
Return the authoritative immutable object size.
virtual ~EvpackRangeSource()=default
Releases EvpackRangeSource resources.
Fully admitted owning runtime pack.
Definition Evpack.h:164
Thread-safe file-backed range source; each request owns its file stream.
Definition EvpackRange.h:36
Result< std::vector< std::uint8_t > > read(std::uint64_t offset, std::uint64_t size) const override
Reads .
Result< std::uint64_t > size() const override
Returns the size of .
FileEvpackRangeSource(std::filesystem::path path)
Bind a path; the file is opened separately for every operation.
Definition EvpackRange.h:39
Result< EvpackRangeMount > prepareEvpackRangeMount(std::shared_ptr< const EvpackRangeSource > source, const EvpackLimits &limits, const EvpackTrust &trust)
Read only header/manifest/TOC and prepare on-demand range loading.
Resource limits checked before package allocations and hash work.
Definition Evpack.h:126
Trust inputs kept separate from size/resource limits.
Definition Evpack.h:75