LoadState

This Enum represents the load state of a collection or partition returned by GetLoadState(). A collection or partition must be in the LOAD_STATE_LOADED state before search and query operations can be performed on it.

enum class LoadState {
    LOAD_STATE_NOT_EXIST = 0,
    LOAD_STATE_NOT_LOAD  = 1,
    LOAD_STATE_LOADING   = 2,
    LOAD_STATE_LOADED    = 3,
};

VALUES:

  • LOAD_STATE_NOT_EXIST (0) - The collection or partition does not exist.

  • LOAD_STATE_NOT_LOAD (1) - The collection or partition exists but has not been loaded into query node memory. Call LoadCollection() or LoadPartitions() before searching.

  • LOAD_STATE_LOADING (2) - The collection or partition is currently being loaded into query node memory. Wait for the state to transition to LOAD_STATE_LOADED.

  • LOAD_STATE_LOADED (3) - Fully loaded and ready for Search() and Query() operations.

Example

#include "milvus/MilvusClientV2.h"
#include <milvus/MilvusClientV2.h>
#include <milvus/types/LoadState.h>
using namespace milvus;

auto client = MilvusClientV2::Create();
client->Connect(ConnectParam("http://localhost:19530").WithToken("root:Milvus"));

GetLoadStateResponse resp;
auto status = client->GetLoadState(
    GetLoadStateRequest().WithCollectionName("my_collection"), resp);

switch (resp.State()) {
    case LoadState::LOAD_STATE_LOADED:
        std::cout << "Collection is ready for search." << std::endl;
        break;
    case LoadState::LOAD_STATE_LOADING:
        std::cout << "Collection is still loading..." << std::endl;
        break;
    case LoadState::LOAD_STATE_NOT_LOAD:
        std::cout << "Collection is not loaded. Call LoadCollection() first." << std::endl;
        break;
    case LoadState::LOAD_STATE_NOT_EXIST:
        std::cout << "Collection does not exist." << std::endl;
        break;
}

Try Managed Milvus for Free

Zilliz Cloud is hassle-free, powered by Milvus and 10x faster.

Get Started
Feedback

Was this page helpful?