Documentation ¶
Index ¶
- Variables
- type ArchiveEntry
- type ArchiveMapper
- type Client
- type LowLevelClient
- func (c *LowLevelClient) ArchiveMapper(ctx context.Context, cdn ngdp.CDNInfo, archives []ngdp.CDNHash) (*ArchiveMapper, error)
- func (c *LowLevelClient) BuildConfig(ctx context.Context, cdn ngdp.CDNInfo, version ngdp.VersionInfo) (ngdp.BuildConfig, error)
- func (c *LowLevelClient) CDN(ctx context.Context, program ngdp.ProgramCode, region ngdp.Region) (ngdp.CDNInfo, error)
- func (c *LowLevelClient) CDNConfig(ctx context.Context, cdn ngdp.CDNInfo, version ngdp.VersionInfo) (ngdp.CDNConfig, error)
- func (c *LowLevelClient) Configs(ctx context.Context, cdn ngdp.CDNInfo, version ngdp.VersionInfo) (ngdp.CDNConfig, ngdp.BuildConfig, error)
- func (c *LowLevelClient) EncodingTable(ctx context.Context, cdn ngdp.CDNInfo, encodingHash ngdp.CDNHash) (*encoding.Mapper, error)
- func (c *LowLevelClient) Fetch(ctx context.Context, cdnInfo ngdp.CDNInfo, cdnHash ngdp.CDNHash) (io.ReadCloser, error)
- func (c *LowLevelClient) Info(ctx context.Context, program ngdp.ProgramCode, region ngdp.Region) (ngdp.CDNInfo, ngdp.VersionInfo, error)
- func (c *LowLevelClient) Mappers(ctx context.Context, cdn ngdp.CDNInfo, cdnConfig ngdp.CDNConfig, ...) (*encoding.Mapper, *ArchiveMapper, error)
- func (llc *LowLevelClient) NewArchiveMapper(ctx context.Context, cdnInfo ngdp.CDNInfo, archives []ngdp.CDNHash) (*ArchiveMapper, error)
- func (c *LowLevelClient) Version(ctx context.Context, program ngdp.ProgramCode, region ngdp.Region) (ngdp.VersionInfo, error)
- type Response
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnknownRegion means that the region is invalid. ErrUnknownRegion = errors.New("client: unknown region") // ErrUnknownProgram means that the supplied program code does not refer to a // currently available Blizzard program. ErrUnknownProgram = errors.New("client: unknown program") // ErrNoFilenameMapper means that the Client has no FilenameMapper assigned to it. // FilenameMappers are program specific and must be added after calling client.New(). ErrNoFilenameMapper = errors.New("client: no filename mapper registered") // ErrNotExists means that the requested file does not exist. ErrNotExists = errors.New("client: no such file") )
Functions ¶
This section is empty.
Types ¶
type ArchiveEntry ¶
An ArchiveEntry contains the location of a given file within the archive set.
type ArchiveMapper ¶
type ArchiveMapper struct {
// contains filtered or unexported fields
}
An ArchiveMapper maps file CDN hashes to their location within the set of archives.
func (*ArchiveMapper) Map ¶
func (e *ArchiveMapper) Map(in ngdp.CDNHash) (entry ArchiveEntry, ok bool)
Map takes a CDNHash of a desired file and returns the CDNHash of the containing archive, as well as the size and offset within the archive.
If the file does not exist in any known archives, then ok will be false.
type Client ¶
type Client struct { LowLevelClient *LowLevelClient CDNInfo *ngdp.CDNInfo VersionInfo *ngdp.VersionInfo BuildConfig *ngdp.BuildConfig CDNConfig *ngdp.CDNConfig ArchiveMapper *ArchiveMapper EncodingMapper *encoding.Mapper FilenameMapper ngdp.FilenameMapper }
A Client provides a nice interface to interacting with NGDP, to make retrieving individual files easy.
func New ¶
New creates a new Client for the given ProgramCode and Region.
It will automatically create an ArchiveMapper and Encoder as appropriate.
func (*Client) Fetch ¶
Fetch retrieves a given file by the hash of its contents. After all, CASC is content-addressable storage.
func (*Client) FetchFilename ¶
FetchFilename retrieves a given file by its filename.
FetchFilename requires that a FilenameMapper has been registered. For Heroes of the Storm, mndx.Decorate can be used to register an appropriate mapper.
type LowLevelClient ¶
A LowLevelClient provides simple wrappers to make basic NGDP operations easier.
func (*LowLevelClient) ArchiveMapper ¶
func (c *LowLevelClient) ArchiveMapper(ctx context.Context, cdn ngdp.CDNInfo, archives []ngdp.CDNHash) (*ArchiveMapper, error)
func (*LowLevelClient) BuildConfig ¶
func (c *LowLevelClient) BuildConfig(ctx context.Context, cdn ngdp.CDNInfo, version ngdp.VersionInfo) (ngdp.BuildConfig, error)
func (*LowLevelClient) CDN ¶
func (c *LowLevelClient) CDN(ctx context.Context, program ngdp.ProgramCode, region ngdp.Region) (ngdp.CDNInfo, error)
func (*LowLevelClient) CDNConfig ¶
func (c *LowLevelClient) CDNConfig(ctx context.Context, cdn ngdp.CDNInfo, version ngdp.VersionInfo) (ngdp.CDNConfig, error)
func (*LowLevelClient) Configs ¶
func (c *LowLevelClient) Configs(ctx context.Context, cdn ngdp.CDNInfo, version ngdp.VersionInfo) (ngdp.CDNConfig, ngdp.BuildConfig, error)
func (*LowLevelClient) EncodingTable ¶
func (*LowLevelClient) Fetch ¶
func (c *LowLevelClient) Fetch(ctx context.Context, cdnInfo ngdp.CDNInfo, cdnHash ngdp.CDNHash) (io.ReadCloser, error)
Fetch retrieves a piece of data content by its CDNHash.
func (*LowLevelClient) Info ¶
func (c *LowLevelClient) Info(ctx context.Context, program ngdp.ProgramCode, region ngdp.Region) (ngdp.CDNInfo, ngdp.VersionInfo, error)
func (*LowLevelClient) Mappers ¶
func (c *LowLevelClient) Mappers(ctx context.Context, cdn ngdp.CDNInfo, cdnConfig ngdp.CDNConfig, buildConfig ngdp.BuildConfig) (*encoding.Mapper, *ArchiveMapper, error)
func (*LowLevelClient) NewArchiveMapper ¶
func (llc *LowLevelClient) NewArchiveMapper(ctx context.Context, cdnInfo ngdp.CDNInfo, archives []ngdp.CDNHash) (*ArchiveMapper, error)
NewArchiveMapper creates a new archive mapper from the provided set of archives.
func (*LowLevelClient) Version ¶
func (c *LowLevelClient) Version(ctx context.Context, program ngdp.ProgramCode, region ngdp.Region) (ngdp.VersionInfo, error)
type Response ¶
type Response struct { // Body is the actual file itself. It must be closed when no longer needed. Body io.ReadCloser // ContentHash is the file's content hash. ContentHash ngdp.ContentHash // CDNHash is the *file's* CDN hash. CDNHash ngdp.CDNHash // RetrievedCDNHash is the CDN hash of the file which was actually retrieved. // If the file was inside an archive, then this will be the archive's CDN hash. RetrievedCDNHash ngdp.CDNHash }
A Response is returned from retrieving a file.