Blender V5.3
blender::asset_system::RemoteLibraryLoadingStatus Class Reference

#include <AS_remote_library.hh>

Public Types

enum  Status { Loading , Finished , Failure , Cancelled }
using TimePoint = std::chrono::time_point<std::chrono::steady_clock>
using FileSystemTimePoint = std::filesystem::file_time_type

Remote Library Loading Status

static void begin_loading (StringRef url, float timeout)
static void ping_still_loading (StringRef url)
static void ping_new_pages (StringRef url)
static void ping_new_preview (const bContext &C, StringRef preview_full_filepath)
static void ping_asset_file_progress (StringRef absolute_file_url, int64_t size_in_bytes)
static void ping_asset_file_download_succeeded (const bContext &C, StringRef library_url, StringRef absolute_file_url, StringRef local_file_abspath)
static void ping_asset_file_download_failed (const bContext &C, StringRef library_url, StringRef absolute_file_url, StringRef local_file_abspath)
static void ping_download_queue_done (const bContext &C)
static void ping_metafiles_in_place (StringRef url)
static void set_finished (StringRef url)
static void set_cancelled (const StringRef url)
static void set_failure (StringRef url, std::optional< StringRefNull > failure_message)
static std::optional< StringRefNull > failure_message (StringRef url)
static std::optional< RemoteLibraryLoadingStatus::Status > status (StringRef url)
static std::optional< bool > metafiles_in_place (StringRef url)
static std::optional< FileSystemTimePoint > loading_start_time (const StringRef url)
static std::optional< TimePoint > last_new_pages_time (StringRef url)
static bool handle_timeout (StringRef url)

Detailed Description

Status information about an externally loaded asset library listing, stored globally.

Remote asset library downloading is handled in Python. This API allows storing status information globally per URL. Asset UIs can then query the status and reflect it accordingly.

Another important use is coordinating the Python side downloading with the C++ side loading. The C++ asset library loading might have to wait for Python to be done downloading and validating individual asset listing pages, and load in these new pages as they become ready.

All functions must be called on the same thread.

Definition at line 194 of file AS_remote_library.hh.

Member Typedef Documentation

◆ FileSystemTimePoint

Definition at line 203 of file AS_remote_library.hh.

◆ TimePoint

using blender::asset_system::RemoteLibraryLoadingStatus::TimePoint = std::chrono::time_point<std::chrono::steady_clock>

Definition at line 202 of file AS_remote_library.hh.

Member Enumeration Documentation

◆ Status

Enumerator
Loading 
Finished 
Failure 
Cancelled 

Definition at line 196 of file AS_remote_library.hh.

Member Function Documentation

◆ begin_loading()

void blender::asset_system::RemoteLibraryLoadingStatus::begin_loading ( StringRef url,
float timeout )
static

◆ failure_message()

◆ handle_timeout()

bool blender::asset_system::RemoteLibraryLoadingStatus::handle_timeout ( StringRef url)
static

Checks if the status storage timed out, because it hasn't received status updates for the given timeout duration. Changes the status to failure in that case.

Note that this function doesn't do more than check if the timeout is reached, and changing state to failure if so. It's meant to be called in regular, short intervals to make the whole timeout handling work. Current remote asset library loading takes care of this.

Returns
True if the loading status switched to #Status::Failure due to timing out.

Definition at line 627 of file remote_library.cc.

References Failure, blender::asset_system::library_to_status_map(), Loading, blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_ptr(), and RPT_.

Referenced by blender::filelist_remote_asset_library_update_loading_flags().

◆ last_new_pages_time()

◆ loading_start_time()

◆ metafiles_in_place()

std::optional< bool > blender::asset_system::RemoteLibraryLoadingStatus::metafiles_in_place ( StringRef url)
static

◆ ping_asset_file_download_failed()

void blender::asset_system::RemoteLibraryLoadingStatus::ping_asset_file_download_failed ( const bContext & C,
StringRef library_url,
StringRef absolute_file_url,
StringRef local_file_abspath )
static

Should be called when an asset file download has failed. Partial progress for the file is reset to zero, since a future retry has to start from scratch.

Definition at line 502 of file remote_library.cc.

References C, blender::asset_system::Failed, and blender::asset_system::ping_asset_file_done_impl().

◆ ping_asset_file_download_succeeded()

void blender::asset_system::RemoteLibraryLoadingStatus::ping_asset_file_download_succeeded ( const bContext & C,
StringRef library_url,
StringRef absolute_file_url,
StringRef local_file_abspath )
static

Should be called when an asset file download has completed successfully.

Definition at line 492 of file remote_library.cc.

References C, blender::asset_system::ping_asset_file_done_impl(), and blender::asset_system::Succeeded.

◆ ping_asset_file_progress()

void blender::asset_system::RemoteLibraryLoadingStatus::ping_asset_file_progress ( StringRef absolute_file_url,
int64_t size_in_bytes )
static

◆ ping_download_queue_done()

void blender::asset_system::RemoteLibraryLoadingStatus::ping_download_queue_done ( const bContext & C)
static

Inform the asset system that there are no more pending asset file downloads for any asset library.

Definition at line 512 of file remote_library.cc.

References C, blender::CTX_wm_manager(), and blender::asset_system::ProgressTracker::on_all_finished().

◆ ping_metafiles_in_place()

void blender::asset_system::RemoteLibraryLoadingStatus::ping_metafiles_in_place ( StringRef url)
static

◆ ping_new_pages()

void blender::asset_system::RemoteLibraryLoadingStatus::ping_new_pages ( StringRef url)
static

◆ ping_new_preview()

void blender::asset_system::RemoteLibraryLoadingStatus::ping_new_preview ( const bContext & C,
StringRef preview_full_filepath )
static

◆ ping_still_loading()

void blender::asset_system::RemoteLibraryLoadingStatus::ping_still_loading ( StringRef url)
static

Let the state know that the loading is still ongoing, resetting the timeout.

Definition at line 439 of file remote_library.cc.

References blender::asset_system::library_to_status_map(), Loading, and blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_ptr().

◆ set_cancelled()

◆ set_failure()

void blender::asset_system::RemoteLibraryLoadingStatus::set_failure ( StringRef url,
std::optional< StringRefNull > failure_message )
static

◆ set_finished()

void blender::asset_system::RemoteLibraryLoadingStatus::set_finished ( StringRef url)
static

◆ status()


The documentation for this class was generated from the following files: