core

package
v0.0.0-...-26386a0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func IpfsOffline

func IpfsOffline(cfg *kubo.BuildCfg) *kubo.BuildCfg

func IpfsOnline

func IpfsOnline(cfg *kubo.BuildCfg) *kubo.BuildCfg

func ReadConfigAsMap

func ReadConfigAsMap(filename string) (map[string]any, error)

Types

type Config

type Config struct {
	User         *UserConfig     `toml:"user,omitempty"`
	Editor       string          `toml:"editor,omitempty"`
	RemoteString string          `toml:"remote,omitempty"`
	Ipfs         *IpfsConfig     `toml:"ipfs,omitempty"`
	Database     *DatabaseConfig `toml:"database,omitempty"`
	Remote       *Remote         `toml:"-"`
}

func ReadConfig

func ReadConfig(r io.Reader) (*Config, error)

func ReadConfigFile

func ReadConfigFile(filename string) (*Config, error)

func (*Config) Encode

func (config *Config) Encode(w io.Writer) error

func (*Config) Read

func (config *Config) Read(r io.Reader) error

func (*Config) ReadFile

func (config *Config) ReadFile(filename string) error

func (*Config) WriteFile

func (config *Config) WriteFile(filename string) error

type Conflict

type Conflict struct {
	Left  *Version
	Right *Version
}

func (Conflict) String

func (c Conflict) String() string

type DatabaseConfig

type DatabaseConfig struct {
	Path string `toml:"path"`
}

type Dorothy

type Dorothy struct {
	context.Context
	Directory     string
	LoadedConfigs []string
	Config        Config
	Ipfs          Ipfs
	Manifest      *Manifest
	// contains filtered or unexported fields
}

func Clone

func Clone(remote, dest string, global bool) (*Dorothy, error)

func NewDorothy

func NewDorothy() (*Dorothy, error)

func (*Dorothy) Checkout

func (d *Dorothy) Checkout(hash, dest string) error

func (*Dorothy) ChooseVersions

func (d *Dorothy) ChooseVersions(title string, required bool) ([]string, error)

func (*Dorothy) ChooseVersionsWithSelected

func (d *Dorothy) ChooseVersionsWithSelected(title string, required bool, selected []*Version) ([]string, error)

func (*Dorothy) Commit

func (d *Dorothy) Commit(paths []string, message string, nopin bool, parents []string) ([]Conflict, error)

func (*Dorothy) ConnectIpfs

func (d *Dorothy) ConnectIpfs(options ...IpfsNodeOption) error

func (*Dorothy) CookiesPath

func (d *Dorothy) CookiesPath() string

func (*Dorothy) DelConfig

func (d *Dorothy) DelConfig(props []string, global bool) (string, error)

func (*Dorothy) Fetch

func (d *Dorothy) Fetch() ([]Conflict, error)

func (*Dorothy) GetConfig

func (d *Dorothy) GetConfig(props []string) (any, error)

func (*Dorothy) GlobalConfigPath

func (d *Dorothy) GlobalConfigPath() string

func (*Dorothy) Initialize

func (d *Dorothy) Initialize(global bool, options ...IpfsNodeOption) error

func (*Dorothy) InitializeAndConnectIpfs

func (d *Dorothy) InitializeAndConnectIpfs(options ...IpfsNodeOption) error

func (*Dorothy) InitializeIpfs

func (d *Dorothy) InitializeIpfs() error

func (*Dorothy) IsInitialized

func (d *Dorothy) IsInitialized() bool

func (*Dorothy) LoadConfigFile

func (d *Dorothy) LoadConfigFile(filename string) error

func (*Dorothy) LoadDefaultConfig

func (d *Dorothy) LoadDefaultConfig() error

func (*Dorothy) LoadGlobalConfig

func (d *Dorothy) LoadGlobalConfig() error

func (*Dorothy) LoadLocalConfig

func (d *Dorothy) LoadLocalConfig() error

func (*Dorothy) LoadManifest

func (d *Dorothy) LoadManifest() error

func (*Dorothy) LocalConfigPath

func (d *Dorothy) LocalConfigPath() string

func (*Dorothy) ManifestPath

func (d *Dorothy) ManifestPath() string

func (*Dorothy) Push

func (d *Dorothy) Push() ([]Conflict, error)

func (*Dorothy) ReadFromEditor

func (d *Dorothy) ReadFromEditor(filename string) (string, error)

func (*Dorothy) Recieve

func (d *Dorothy) Recieve(old *Manifest, hash string) (*Manifest, []Conflict, error)

func (*Dorothy) ReloadConfig

func (d *Dorothy) ReloadConfig() error

func (*Dorothy) ReloadIpfs

func (d *Dorothy) ReloadIpfs() error

func (*Dorothy) ResetConfig

func (d *Dorothy) ResetConfig() error

func (*Dorothy) SdkClient

func (d *Dorothy) SdkClient() (*sdk.Client, error)

func (*Dorothy) SetConfig

func (d *Dorothy) SetConfig(props []string, value string, global bool) (string, error)

func (*Dorothy) Setup

func (d *Dorothy) Setup(options ...IpfsNodeOption) error

func (*Dorothy) UnknownCommits

func (d *Dorothy) UnknownCommits(commits []string) []string

func (*Dorothy) WriteConfig

func (d *Dorothy) WriteConfig() error

func (*Dorothy) WriteManifestFile

func (d *Dorothy) WriteManifestFile() error

type Ipfs

type Ipfs struct {
	icore.CoreAPI
	Identity peer.ID
	// contains filtered or unexported fields
}

func NewIpfs

func NewIpfs(config *IpfsConfig) Ipfs

func (*Ipfs) Add

func (s *Ipfs) Add(ctx context.Context, filename string, options ...options.UnixfsAddOption) (string, error)

func (Ipfs) AddMany

func (s Ipfs) AddMany(ctx context.Context, filenames []string, options ...options.UnixfsAddOption) (string, error)

func (Ipfs) Commit

func (s Ipfs) Commit(ctx context.Context, manifest *Manifest) (*Manifest, error)

func (Ipfs) CommitVersion

func (s Ipfs) CommitVersion(ctx context.Context, version *Version) (string, error)

func (*Ipfs) Connect

func (s *Ipfs) Connect(ctx context.Context, dir string, options ...IpfsNodeOption) error

func (*Ipfs) ConnectToPeerById

func (s *Ipfs) ConnectToPeerById(ctx context.Context, id peer.ID) error

func (*Ipfs) CreateEmptyManifest

func (s *Ipfs) CreateEmptyManifest(ctx context.Context) (*Manifest, error)

func (*Ipfs) Get

func (s *Ipfs) Get(ctx context.Context, hash, dest string) error

func (*Ipfs) GetManifest

func (s *Ipfs) GetManifest(ctx context.Context, hash string) (*Manifest, error)

func (*Ipfs) Initialize

func (s *Ipfs) Initialize(dir string) error

func (*Ipfs) IsConnected

func (s *Ipfs) IsConnected() bool

func (Ipfs) MergeAndCommit

func (s Ipfs) MergeAndCommit(ctx context.Context, old, new *Manifest) (*Manifest, []Conflict, error)

func (*Ipfs) SaveManifest

func (s *Ipfs) SaveManifest(ctx context.Context, manifest *Manifest) (*Manifest, error)

type IpfsConfig

type IpfsConfig struct {
	Global bool   `toml:"global"`
	Host   string `toml:"host,omitempty"`
	Port   int    `toml:"port,omitempty"`
}

func (IpfsConfig) Multiaddr

func (c IpfsConfig) Multiaddr() (ma.Multiaddr, error)

func (IpfsConfig) Url

func (c IpfsConfig) Url() string

type IpfsNodeOption

type IpfsNodeOption func(*kubo.BuildCfg) *kubo.BuildCfg

type Manifest

type Manifest struct {
	Versions []*Version `json:"versions"`
	Hash     string     `json:"-"`
}

func (*Manifest) Conflicts

func (old *Manifest) Conflicts(new *Manifest) ([]Conflict, bool)

func (*Manifest) Diff

func (old *Manifest) Diff(new *Manifest) ([]*Version, error)

func (*Manifest) Encode

func (manifest *Manifest) Encode(w io.Writer) error

func (*Manifest) IpfsPath

func (m *Manifest) IpfsPath() (path.ImmutablePath, error)

func (*Manifest) IsEmpty

func (manifest *Manifest) IsEmpty() bool

func (*Manifest) LeafVersions

func (manifest *Manifest) LeafVersions() []*Version

func (*Manifest) Merge

func (old *Manifest) Merge(new *Manifest) (*Manifest, []Conflict, error)

func (*Manifest) ReverseVersions

func (m *Manifest) ReverseVersions() []*Version

func (*Manifest) UnknownCommits

func (manifest *Manifest) UnknownCommits(commits []string) []string

type PathType

type PathType string
const (
	PathTypeDirectory PathType = "DIRECTORY"
	PathTypeFile      PathType = "FILE"
)

func (PathType) IsValid

func (e PathType) IsValid() bool

func (PathType) MarshalGQL

func (e PathType) MarshalGQL(w io.Writer)

func (PathType) String

func (e PathType) String() string

func (*PathType) UnmarshalGQL

func (e *PathType) UnmarshalGQL(v interface{}) error

type Remote

type Remote struct {
	Scheme       string
	Host         string
	Organization string
	Dataset      string
}

func NewRemote

func NewRemote(remote string) (*Remote, error)

func (Remote) BaseUrl

func (r Remote) BaseUrl() *url.URL

func (Remote) String

func (r Remote) String() string

func (Remote) Url

func (r Remote) Url() *url.URL

func (Remote) UrlString

func (r Remote) UrlString() string

type UserConfig

type UserConfig struct {
	Name  string `toml:"name,omitempty"`
	Email string `toml:"email,omitempty"`
}

func (*UserConfig) String

func (u *UserConfig) String() string

type Version

type Version struct {
	Author   string    `json:"author"`
	Date     time.Time `json:"date"`
	Message  string    `json:"message"`
	Hash     string    `json:"hash"`
	PathType PathType  `json:"path_type"`
	Parents  []string  `json:"parents"`
}

func (*Version) Equal

func (v *Version) Equal(o *Version) bool

func (*Version) IpfsPath

func (v *Version) IpfsPath() (path.ImmutablePath, error)

func (*Version) Less

func (v *Version) Less(o *Version) bool

func (*Version) SameHash

func (v *Version) SameHash(o *Version) bool

func (*Version) SameParents

func (v *Version) SameParents(o *Version) bool

Jump to

Keyboard shortcuts

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