janelia-flyem / dvid

Distributed, Versioned, Image-oriented Dataservice
http://dvid.io
Other
195 stars 33 forks source link

Need POST .../maxlabel #307

Closed stuarteberg closed 1 year ago

stuarteberg commented 5 years ago

The labelmap instance supports GET .../maxlabel, but does not support POST. When "manually" patching the raw supervoxel segmentation, it is necessary to explicitly set the max label in the instance.

Since this is potentially a very dangerous operation, perhaps some extra checks should be performed:

Other questions:

DocSavage commented 5 years ago

Max label setting cannot decrease the current max label. It will return an error. I do not believe this should be considered a mutation. The maximum label in a repo (which may be modified if the max label for a version exceeds it) is used to generate new labels on split. The maximum labels per version will be used just for remote version integration, where labels could collide. By knowing the maximum label for a shared locked node, you know downstream labels higher than this were newly introduced.

The operation will be logged to kafka if it's available.

I also noticed the /nextlabel APIs were partially usable so I've fixed that. The suite of endpoints dealing with max labels is now this:

GET <api URL>/node/<UUID>/<data name>/maxlabel

    GET returns the maximum label for the version of data in JSON form:

        { "maxlabel": <label #> }

POST <api URL>/node/<UUID>/<data name>/maxlabel/<max label>

    Sets the maximum label for the version of data specified by the UUID.  This maximum label will be 
    ignored if it is not greater than the current maximum label.  This value is purely informative
    (i.e., not used for establishing new labels on split) and can be used to distinguish new labels
    in remote stores that may collide with local ones.

GET <api URL>/node/<UUID>/<data name>/nextlabel

    GET returns what would be a new label for the version of data in JSON form assuming the version
    has not been committed:

        { "nextlabel": <label #> }

POST <api URL>/node/<UUID>/<data name>/nextlabel/<desired # of labels>

    POST allows the client to request some # of labels that will be reserved.
    This is used if the client wants to introduce new labels.

    Response:

        { "start": <starting label #>, "end": <ending label #> }

    Unlike POST /maxlabel, which can set the maximum label arbitrarily high, this
    endpoint gives incremental new label ids.