Skip to content

Add SetIfAbsent(), returning a value indicating whether the key already existed #39

@anorth

Description

@anorth

The Set method is implemented as blind upsert and does not return any indication of what value, if any, previously existed for the key in question. Callers that wish to leave any existing value intact, or save or report it elsewhere after it is overwritten, must first perform a Get or Has in order to establish if one exists. Set could instead return an indication of whether the key previously existed.

See discussion about this for the HAMT in filecoin-project/go-hamt-ipld#75.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions