Documentation
¶
Index ¶
- type Client
- func (c *Client) GetContainerByID(ctx context.Context, id ids.ID, options ...rpc.Option) (Container, uint64, error)
- func (c *Client) GetContainerByIndex(ctx context.Context, index uint64, options ...rpc.Option) (Container, error)
- func (c *Client) GetContainerRange(ctx context.Context, startIndex uint64, numToFetch int, options ...rpc.Option) ([]Container, error)
- func (c *Client) GetIndex(ctx context.Context, id ids.ID, options ...rpc.Option) (uint64, error)
- func (c *Client) GetLastAccepted(ctx context.Context, options ...rpc.Option) (Container, uint64, error)
- func (c *Client) IsAccepted(ctx context.Context, id ids.ID, options ...rpc.Option) (bool, error)
- type Container
- type FormattedContainer
- type GetContainerByIDArgs
- type GetContainerByIndexArgs
- type GetContainerRangeArgs
- type GetContainerRangeResponse
- type GetIndexArgs
- type GetIndexResponse
- type GetLastAcceptedArgs
- type IsAcceptedArgs
- type IsAcceptedResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Requester rpc.EndpointRequester
}
func NewClient ¶
NewClient creates a client that can interact with an index via HTTP API calls. [uri] is the path to make API calls to. For example:
func (*Client) GetContainerByID ¶
func (c *Client) GetContainerByID(ctx context.Context, id ids.ID, options ...rpc.Option) (Container, uint64, error)
Get a container and its index by its ID
func (*Client) GetContainerByIndex ¶
func (c *Client) GetContainerByIndex(ctx context.Context, index uint64, options ...rpc.Option) (Container, error)
Get a container by its index
func (*Client) GetContainerRange ¶
func (c *Client) GetContainerRange(ctx context.Context, startIndex uint64, numToFetch int, options ...rpc.Option) ([]Container, error)
GetContainerRange returns the transactions at index [startIndex], [startIndex+1], ... , [startIndex+n-1] If [n] == 0, returns an empty response (i.e. null). If [startIndex] > the last accepted index, returns an error (unless the above apply.) If we run out of transactions, returns the ones fetched before running out.
type Container ¶
type Container struct {
// ID of this container
ID ids.ID `serialize:"true"`
// Byte representation of this container
Bytes []byte `serialize:"true"`
// Unix time, in nanoseconds, at which this container was accepted by this node
Timestamp int64 `serialize:"true"`
}
Container is something that gets accepted (a block, transaction or vertex).
type FormattedContainer ¶
type GetContainerByIDArgs ¶
type GetContainerByIDArgs struct {
ID ids.ID `json:"id"`
Encoding formatting.Encoding `json:"encoding"`
}
type GetContainerByIndexArgs ¶
type GetContainerByIndexArgs struct {
Index json.Uint64 `json:"index"`
Encoding formatting.Encoding `json:"encoding"`
}
type GetContainerRangeArgs ¶
type GetContainerRangeArgs struct {
StartIndex json.Uint64 `json:"startIndex"`
NumToFetch json.Uint64 `json:"numToFetch"`
Encoding formatting.Encoding `json:"encoding"`
}
type GetContainerRangeResponse ¶
type GetContainerRangeResponse struct {
Containers []FormattedContainer `json:"containers"`
}
type GetIndexArgs ¶
type GetIndexResponse ¶
type GetIndexResponse struct {
Index json.Uint64 `json:"index"`
}
type GetLastAcceptedArgs ¶
type GetLastAcceptedArgs struct {
Encoding formatting.Encoding `json:"encoding"`
}
type IsAcceptedArgs ¶
type IsAcceptedResponse ¶
type IsAcceptedResponse struct {
IsAccepted bool `json:"isAccepted"`
}
Click to show internal directories.
Click to hide internal directories.