diff options
author | Runxi Yu <me@runxiyu.org> | 2025-08-12 11:01:07 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-09-15 15:19:12 +0800 |
commit | eb82fdb2dc0903e6125014abd64aceab42c8eb35 (patch) | |
tree | c07276ba1595c415ebc28943163d88f3e3180254 /forged/internal/git2c/client.go | |
parent | Remove forge-specific functions from misc (diff) | |
download | forge-eb82fdb2dc0903e6125014abd64aceab42c8eb35.tar.gz forge-eb82fdb2dc0903e6125014abd64aceab42c8eb35.tar.zst forge-eb82fdb2dc0903e6125014abd64aceab42c8eb35.zip |
Diffstat (limited to 'forged/internal/git2c/client.go')
-rw-r--r-- | forged/internal/git2c/client.go | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/forged/internal/git2c/client.go b/forged/internal/git2c/client.go deleted file mode 100644 index ed9390c..0000000 --- a/forged/internal/git2c/client.go +++ /dev/null @@ -1,46 +0,0 @@ -// SPDX-License-Identifier: AGPL-3.0-only -// SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu <https://runxiyu.org> - -// Package git2c provides routines to interact with the git2d backend daemon. -package git2c - -import ( - "fmt" - "net" - - "go.lindenii.runxiyu.org/forge/forged/internal/bare" -) - -// Client represents a connection to the git2d backend daemon. -type Client struct { - socketPath string - conn net.Conn - writer *bare.Writer - reader *bare.Reader -} - -// NewClient establishes a connection to a git2d socket and returns a new Client. -func NewClient(socketPath string) (*Client, error) { - conn, err := net.Dial("unix", socketPath) - if err != nil { - return nil, fmt.Errorf("git2d connection failed: %w", err) - } - - writer := bare.NewWriter(conn) - reader := bare.NewReader(conn) - - return &Client{ - socketPath: socketPath, - conn: conn, - writer: writer, - reader: reader, - }, nil -} - -// Close terminates the underlying socket connection. -func (c *Client) Close() error { - if c.conn != nil { - return c.conn.Close() - } - return nil -} |