Couchbase .NET SDK | 3.9.0
Search Results for

    Show / Hide Table of Contents

    Class VBucketMapper

    Provides services to apply hash algorithms and map a key to a vBucket ID.

    Inheritance
    object
    VBucketMapper
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Couchbase.Core.Sharding
    Assembly: Couchbase.NetClient.dll
    Syntax
    [InterfaceStability(Level.Volatile)]
    public static class VBucketMapper

    Methods

    | Edit this page View Source

    GetMask(int)

    Calculate the mask used to calculate vBucket IDs based on the number of vBuckets in the cluster. This is primarily a performance optimization, since this can be calculated once and stored.

    Declaration
    public static short GetMask(int vBucketCount)
    Parameters
    Type Name Description
    int vBucketCount

    The number of vBuckets in the cluster.

    Returns
    Type Description
    short

    The mask to use when calculating the vBucket ID.

    | Edit this page View Source

    GetVBucketId(ReadOnlySpan<byte>, short)

    Get the vBucketID for a given key.

    Declaration
    public static short GetVBucketId(ReadOnlySpan<byte> keyBytes, short mask)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> keyBytes

    The key encoded as UTF-8.

    short mask

    The previously calculated mask from a call to GetMask(int).

    Returns
    Type Description
    short

    The vBucketID for the key.

    | Edit this page View Source

    GetVBucketId(ReadOnlySpan<byte>, int)

    Get the vBucketID for a given key.

    Declaration
    public static short GetVBucketId(ReadOnlySpan<byte> keyBytes, int vBucketCount)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> keyBytes

    The key encoded as UTF-8.

    int vBucketCount

    The number of vBuckets in the cluster.

    Returns
    Type Description
    short

    The vBucketID for the key.

    | Edit this page View Source

    GetVBucketId(string, short)

    Get the vBucketID for a given key.

    Declaration
    public static short GetVBucketId(string key, short mask)
    Parameters
    Type Name Description
    string key

    The key.

    short mask

    The previously calculated mask from a call to GetMask(int).

    Returns
    Type Description
    short

    The vBucketID for the key.

    • Edit this page
    • View Source
    In this article
    Back to top © 2026 Couchbase, Inc.