Skip to content

Snowflake - Add Producer Constructor #33

@TheBrambleShark

Description

@TheBrambleShark

Description
This change should add a constructor to the Snowflake type intended for use by servers, or more accurately, producers of new Snowflake values.

API Proposal

public Snowflake(DateTimeOffset timeStamp, byte internalWorkerId, byte internalProcessId, ushort increment, ulong epoch = 0);
public Snowflake(DateTimeOffset timeStamp, byte internalWorkerId, byte internalProcessId, ushort increment, DateTimeOffset? epoch = null);

These methods likely would not be able to forward to the existing Snowflake(ulong, ulong) ctor due to the need for a method body to perform multiple mathematical operations.

Why This is Needed
Currently, the Snowflake type is intended for use solely by consumers, e.g. those who are sent Snowflake values over an API or who store them in a database. This is not suitable for producers of this type, who would currently need to produce the Snowflake value themselves as a ulong, then pass that to the Snowflake(ulong, ulong) ctor.

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