Skip to content

Improve GetOmapValues/GetAllOmapValues methods signatures in rados #1219

Description

@gren236

I would like to propose changing GetOmapValues and GetAllOmapValues methods of rados.IOContext to either not use a map to store key/value pairs or remove startAfter argument from those methods.

The problem with the current interface is the fact that Golang maps are naturally unordered. Thus, the method argument used for consequent pagination - startAfter - provides no value as the last object retrieved in the map iteration is non-deterministic. Sorting those values introduces an avoidable performance drawback. That can cause confusion with the provided interface in general.

My proposal is to either return an ordered slice of structs:

func (ioctx *IOContext) GetOmapValues(oid string, startAfter string, filterPrefix string, maxReturn int64) ([]struct{
	key string
	val string
}, error)

or remove the startAfter argument from the method and refer to ListOmapValues method in docs for proper pagination:

func (ioctx *IOContext) GetOmapValues(oid string, filterPrefix string, maxReturn int64) (map[string][]byte, error)

I would prefer to remove the argument since it seems we already have an interface for the ordered pagination: ListOmapValues.

What do you think? Do I miss any usecases that would make more sense for the current API to stay? I will also happily create a PR for this change :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions