Skip to content

[refactor] new_search api for CancellationToken #191

Description

@hsqStephenZhang

Current CancellationToken::new requires a version argument, which is maintained/passed by the frontend.
To make frontend and http api works together, I wonder if we could simplify the version mechanism as the following way:

impl CancellationToken {
    pub fn new_search() -> Self {
        let version = ACTIVE_SEARCH_VERSION.fetch_add(1, Ordering::SeqCst) + 1;
        Self {
            version,
            active_version: &ACTIVE_SEARCH_VERSION,
        }
    }
}

It aligns with the existing new_scan method, which is easier to use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions