repo

package
v0.0.0-...-65d01b3 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewIPFSRepo

NewIPFSRepo returns a new IPFSNode instance

Types

type AddResponse

type AddResponse struct {
	Bytes      int64  `json:"Bytes"`
	Hash       string `json:"Hash"`
	Mode       string `json:"Mode"`
	Mtime      int64  `json:"Mtime"`
	MtimeNsecs int    `json:"MtimeNsecs"`
	Name       string `json:"Name"`
	Size       string `json:"Size"`
}

AddResponse represents the response from the /api/v0/add endpoint

type IPFSRepo

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

func (*IPFSRepo) AddViaFile

func (r *IPFSRepo) AddViaFile(file *os.File, shouldPin bool) (string, error)

func (*IPFSRepo) AddViaFileContent

func (r *IPFSRepo) AddViaFileContent(fileContent []byte, shouldPin bool) (string, error)

func (*IPFSRepo) AddViaFilePath

func (r *IPFSRepo) AddViaFilePath(fullFilePath string, shouldPin bool) (string, error)

func (*IPFSRepo) AddViaReaderFile

func (r *IPFSRepo) AddViaReaderFile(node files.File, shouldPin bool) (string, error)

func (*IPFSRepo) Get

func (s *IPFSRepo) Get(ctx context.Context, cidString string) ([]byte, string, error)

Cat retrieves the contents of a file from IPFS

func (*IPFSRepo) ID

func (r *IPFSRepo) ID() (peer.ID, error)

ID returns the IPFS node's identity information

func (*IPFSRepo) Pin

func (impl *IPFSRepo) Pin(cidString string) error

func (*IPFSRepo) PinAddViaFilePath

func (r *IPFSRepo) PinAddViaFilePath(fullFilePath string) (string, error)

type IPFSRepoConfigurationProvider

type IPFSRepoConfigurationProvider interface {
	GetIPFSNodeRemoteIP() string         // Retrieves the remote or local IPFS service remote IP.
	GetIPFSNodeRemotePort() string       // Retrieves the remote or local IPFS service remote port.
	GetPublicIPFSGatewayAddress() string // Retrieves a publically accessible IPFS gateway address.
}

IPFSRepoConfigurationProvider is an interface for configuration providers that provide all needed settings to connect to an IPFS node either remote or a local IPFS node.

func NewIPFSRepoConfigurationProvider

func NewIPFSRepoConfigurationProvider(remoteIP, remotePort, publicGatewayAddress string) IPFSRepoConfigurationProvider

NewIPFSRepoConfigurationProvider constructs a new configuration provider for IPFS connections.

type IPFSRepoConfigurationProviderImpl

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

IPFSRepoConfigurationProviderImpl is a struct that implements IPFSRepoConfigurationProvider for storing IPFS connection details.

func (*IPFSRepoConfigurationProviderImpl) GetIPFSNodeRemoteIP

func (impl *IPFSRepoConfigurationProviderImpl) GetIPFSNodeRemoteIP() string

func (*IPFSRepoConfigurationProviderImpl) GetIPFSNodeRemotePort

func (impl *IPFSRepoConfigurationProviderImpl) GetIPFSNodeRemotePort() string

func (*IPFSRepoConfigurationProviderImpl) GetPublicIPFSGatewayAddress

func (impl *IPFSRepoConfigurationProviderImpl) GetPublicIPFSGatewayAddress() string

type PinObjectRepo

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

func NewPinObjectRepo

func NewPinObjectRepo(logger *slog.Logger, dbByCIDClient disk.Storage, dbByRequestIDClient disk.Storage) *PinObjectRepo

func (*PinObjectRepo) CommitTransaction

func (r *PinObjectRepo) CommitTransaction() error

func (*PinObjectRepo) DeleteByCID

func (r *PinObjectRepo) DeleteByCID(cid string) error

func (*PinObjectRepo) DeleteByRequestID

func (r *PinObjectRepo) DeleteByRequestID(requestID uint64) error

func (*PinObjectRepo) DiscardTransaction

func (r *PinObjectRepo) DiscardTransaction()

func (*PinObjectRepo) GetByCID

func (r *PinObjectRepo) GetByCID(cid string) (*domain.PinObject, error)

func (*PinObjectRepo) GetByRequestID

func (r *PinObjectRepo) GetByRequestID(requestID uint64) (*domain.PinObject, error)

func (*PinObjectRepo) ListAll

func (r *PinObjectRepo) ListAll() ([]*domain.PinObject, error)

func (*PinObjectRepo) OpenTransaction

func (r *PinObjectRepo) OpenTransaction() error

func (*PinObjectRepo) Upsert

func (r *PinObjectRepo) Upsert(pinobj *domain.PinObject) error

Jump to

Keyboard shortcuts

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