registry

package
v0.0.0-...-38831a8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache manages local cache for registry data

func NewCache

func NewCache(cacheDir string) *Cache

NewCache creates a new cache manager

func (*Cache) CleanExpired

func (c *Cache) CleanExpired()

CleanExpired removes expired cache entries

func (*Cache) Clear

func (c *Cache) Clear() error

Clear clears all cache entries

func (*Cache) GetCacheDir

func (c *Cache) GetCacheDir() string

GetCacheDir returns the cache directory path

func (*Cache) GetCacheStats

func (c *Cache) GetCacheStats() map[string]interface{}

GetCacheStats returns cache statistics

func (*Cache) GetPackageMetadata

func (c *Cache) GetPackageMetadata(name string) (*PackageMetadata, bool)

GetPackageMetadata retrieves package metadata from cache

func (*Cache) GetTarball

func (c *Cache) GetTarball(key string) (string, bool)

GetTarball retrieves tarball path from cache

func (*Cache) SetPackageMetadata

func (c *Cache) SetPackageMetadata(name string, metadata *PackageMetadata)

SetPackageMetadata stores package metadata in cache

func (*Cache) SetTarball

func (c *Cache) SetTarball(key, path string)

SetTarball stores tarball path in cache

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a registry client

func NewClient

func NewClient(config *RegistryConfig) (*Client, error)

NewClient creates a new registry client

func (*Client) Download

func (c *Client) Download(name, version string) (string, error)

Download downloads a package tarball

func (*Client) GetConfig

func (c *Client) GetConfig() *RegistryConfig

GetConfig returns the registry configuration

func (*Client) GetPackage

func (c *Client) GetPackage(name string) (*PackageMetadata, error)

GetPackage retrieves package metadata from the registry

func (*Client) GetPackageVersion

func (c *Client) GetPackageVersion(name, version string) (*PackageVersion, error)

GetPackageVersion retrieves a specific version of a package

func (*Client) Install

func (c *Client) Install(name, version, targetDir string) error

Install installs a package to the specified directory

func (*Client) Publish

func (c *Client) Publish(req *PublishRequest) error

Publish publishes a package to the registry

func (*Client) Search

func (c *Client) Search(query *SearchQuery) ([]*SearchResult, error)

Search searches for packages in the registry

func (*Client) SetToken

func (c *Client) SetToken(token string)

SetToken sets the authentication token

type DownloadInfo

type DownloadInfo struct {
	PackageName string `json:"packageName"`
	Version     string `json:"version"`
	TarballURL  string `json:"tarballUrl"`
	Checksum    string `json:"checksum"`
	Size        int64  `json:"size"`
}

DownloadInfo represents package download information

type Package

type Package struct {
	Name            string            `json:"name"`
	Version         string            `json:"version"`
	Description     string            `json:"description"`
	Author          string            `json:"author"`
	License         string            `json:"license"`
	Homepage        string            `json:"homepage,omitempty"`
	Repository      string            `json:"repository,omitempty"`
	Keywords        []string          `json:"keywords,omitempty"`
	Main            string            `json:"main"`
	Scripts         map[string]string `json:"scripts,omitempty"`
	Dependencies    map[string]string `json:"dependencies,omitempty"`
	DevDependencies map[string]string `json:"devDependencies,omitempty"`
	CreatedAt       time.Time         `json:"createdAt"`
	UpdatedAt       time.Time         `json:"updatedAt"`
	Downloads       int               `json:"downloads"`
	Verified        bool              `json:"verified"`
}

Package represents a package in the registry

type PackageMetadata

type PackageMetadata struct {
	Name          string                     `json:"name"`
	Description   string                     `json:"description"`
	Author        string                     `json:"author"`
	License       string                     `json:"license"`
	Homepage      string                     `json:"homepage,omitempty"`
	Repository    string                     `json:"repository,omitempty"`
	Keywords      []string                   `json:"keywords,omitempty"`
	Versions      map[string]*PackageVersion `json:"versions"`
	LatestVersion string                     `json:"latestVersion"`
	CreatedAt     time.Time                  `json:"createdAt"`
	UpdatedAt     time.Time                  `json:"updatedAt"`
	Downloads     int                        `json:"downloads"`
	Verified      bool                       `json:"verified"`
}

PackageMetadata represents complete package metadata with all versions

type PackageVersion

type PackageVersion struct {
	Version         string            `json:"version"`
	Description     string            `json:"description"`
	Author          string            `json:"author"`
	Main            string            `json:"main"`
	Dependencies    map[string]string `json:"dependencies,omitempty"`
	DevDependencies map[string]string `json:"devDependencies,omitempty"`
	TarballURL      string            `json:"tarballUrl"`
	Shasum          string            `json:"shasum"`
	PublishedAt     time.Time         `json:"publishedAt"`
	Deprecated      bool              `json:"deprecated,omitempty"`
}

PackageVersion represents a specific version of a package

type PublishRequest

type PublishRequest struct {
	Package  *Package `json:"package"`
	Tarball  []byte   `json:"tarball"` // Gzipped tar archive
	Checksum string   `json:"checksum"`
}

PublishRequest represents a package publish request

type RegistryConfig

type RegistryConfig struct {
	URL      string `json:"url"`
	Token    string `json:"token,omitempty"`
	CacheDir string `json:"cacheDir"`
	Timeout  int    `json:"timeout"` // seconds
}

RegistryConfig represents registry configuration

type SearchQuery

type SearchQuery struct {
	Query    string   `json:"query"`
	Keywords []string `json:"keywords,omitempty"`
	Author   string   `json:"author,omitempty"`
	Limit    int      `json:"limit,omitempty"`
	Offset   int      `json:"offset,omitempty"`
}

SearchQuery represents a package search query

type SearchResult

type SearchResult struct {
	Name        string   `json:"name"`
	Version     string   `json:"version"`
	Description string   `json:"description"`
	Author      string   `json:"author"`
	Keywords    []string `json:"keywords,omitempty"`
	Downloads   int      `json:"downloads"`
	Verified    bool     `json:"verified"`
	Score       float64  `json:"score"` // Search relevance score
}

SearchResult represents a package search result

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server represents a local registry server

func NewServer

func NewServer(storageDir string, port int) (*Server, error)

NewServer creates a new registry server

func (*Server) GetAuthToken

func (s *Server) GetAuthToken() string

GetAuthToken returns the server's authentication token

func (*Server) Start

func (s *Server) Start() error

Start starts the registry server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL