gitrh

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

package gitrh provides a Server implementation of the Git remote helper IPC protocol

Index

Constants

View Source
const MaxSize = 1 << 22

MaxSize is the maximum allowed size of an object.

Variables

This section is empty.

Functions

func Main

func Main(ctx context.Context, setup func(grhctx Ctx) (*Server, error))

Main is a harness for the git-remote-helper It takes care of reading from the arguments and running the server. The setup function should handle initialization and return a server.

Types

type Ctx

type Ctx struct {
	Remote string
	URL    string
}
type Header struct {
	Type string
	Len  int
}

func SplitHeader

func SplitHeader(data []byte) (Header, []byte, error)

type Ref

type Ref struct {
	Name   string
	Target [32]byte
}

func (Ref) String

func (gr Ref) String() string

type Server

type Server struct {
	List  func(context.Context) iter.Seq2[Ref, error]
	Fetch func(ctx context.Context, s *Store, toFetch map[string]blobcache.CID, updated map[string]blobcache.CID) error
	Push  func(ctx context.Context, s *Store, refs []Ref) error
}

func (*Server) Serve

func (srv *Server) Serve(ctx context.Context, r io.Reader, w io.Writer) error

type Store

type Store struct {
	SkipVerify bool
}

func (*Store) Exists

func (s *Store) Exists(ctx context.Context, cids []blobcache.CID, dst []bool) error

func (*Store) Get

func (s *Store) Get(ctx context.Context, cid blobcache.CID, buf []byte) (int, error)

func (*Store) Hash

func (s *Store) Hash(x []byte) blobcache.CID

func (*Store) MaxSize

func (s *Store) MaxSize() int

func (*Store) Post

func (s *Store) Post(ctx context.Context, data []byte) (blobcache.CID, error)

Jump to

Keyboard shortcuts

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