From aa513c069c1418734aea894dc944e27c6a78a3bb Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Fri, 20 Feb 2026 19:06:13 +0800 Subject: Delete everything, I'm redesigning this. I'll stop using a flat package and make things much more modular. And also experiment with streaming APIs so large blobs don't OOM us. --- obj_blob.go | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 obj_blob.go (limited to 'obj_blob.go') diff --git a/obj_blob.go b/obj_blob.go deleted file mode 100644 index 70115e6a..00000000 --- a/obj_blob.go +++ /dev/null @@ -1,49 +0,0 @@ -package furgit - -// Blob represents a Git blob object. -type Blob struct { - // Data represents the payload content of the blob. - Data []byte -} - -// StoredBlob represents a blob stored in the object database. -type StoredBlob struct { - Blob - hash Hash -} - -// Hash returns the hash of the stored blob. -func (sBlob *StoredBlob) Hash() Hash { - return sBlob.hash -} - -// ObjectType returns the object type of the blob. -// -// It always returns ObjectTypeBlob. -func (blob *Blob) ObjectType() ObjectType { - _ = blob - return ObjectTypeBlob -} - -func parseBlob(id Hash, body []byte) (*StoredBlob, error) { - data := append([]byte(nil), body...) - return &StoredBlob{ - hash: id, - Blob: Blob{ - Data: data, - }, - }, nil -} - -// Serialize renders the blob into its raw byte representation, -// including the header (i.e., "type size\0"). -func (blob *Blob) Serialize() ([]byte, error) { - header, err := headerForType(ObjectTypeBlob, blob.Data) - if err != nil { - return nil, err - } - raw := make([]byte, len(header)+len(blob.Data)) - copy(raw, header) - copy(raw[len(header):], blob.Data) - return raw, nil -} -- cgit v1.3.1-10-gc9f91