当前位置: 首页 > 软件库 > 大数据 > 数据存储 >

space-daemon

授权协议 Apache-2.0 License
开发语言 Google Go
所属分类 大数据、 数据存储
软件类型 开源软件
地区 不详
投 递 者 戴嘉珍
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Space Daemon

Space Daemon is a wrapper built in Go around awesome IPFS tools so that you can have start coding a decentralized desktop app as fast as possible. It's built on top of Textile Threads and Buckets. Out of the box it includes:

  • A running local instance of Textile Threads.

  • Interfaces to create local private, encrypted buckets.

  • Interfaces for sharing those buckets and the files within.

  • Identity service so that sharing can be done through usernames or emails.

  • FUSE for drive mounting, so that the files can be explored natively in your OS.

  • Key management.

Note: This project is in active development, so it might change its API until it reaches a stable version.

Installation

By default, Space Daemon connects to hosted services provided by Fleek. This should be good if you just want to get it running quickly. However, if you want to connect to your own services, read the Modules Section.

Downloading the binary

Check out the releases here. You can download the latest version for your OS and you should be good to go.

If you want to run Space Daemon by source, check out this section

Usage

Space Daemon provides a gRPC interface. You can read its proto schema here. It contains methods to:

  • Create files and directories

  • List files and directories

  • Creating buckets

  • Sharing buckets

  • Creating identities

You can also use the JavaScript client here https://github.com/FleekHQ/space-client

This can be useful if, for example, you are building a web app that needs to interact with a user's locally running Space Daemon.

Modules

Space Daemon requires a few modules to run successfully. If you downloaded the binary, you don't have to worry about this since it will be connecting to our services. It's good to understand what's happening behind the scenes though.

IPFS Node

All encrypted files are stored in an IPFS node. For convenience, Space Daemon runs an embedded node within the daemon that can be configured as well as the option to specify an external node to connect to.

If you have your own node outside of the daemon, then set the flag -ipfsnode to false. This will not spin up an embedded node. You can then connect to your external node by providing the -ipfsaddr flag (e.g. -ipfsaddr=/ip4/127.0.0.1/tcp/5001).

In the case you are running the embedded IPFS node, you can further configure the listen address and data directory by setting these flags respectively: -ipfsnodeaddr and -ipfsnodepath.

Textile Hub

Required for sharing files between users and backing it up. It stores all backed up files encrypted using a set of keys so that only you, and people you share files with, can read the data. We host our own instance of the Textile Hub, and by default, Space Daemon will conect to it. It can be customized by providing the -textilehub flag and -textilethreads flag.

If you want to host your own Textile Hub node, you can read its documentation here

Space Services

We provide hosted alternatives for these services. You can deploy your own by following the instructions in its repo:

https://github.com/fleekHQ/space-services

Identity

These are centralized services that are optional, but offer additional convenience. Used mainly for identity. By using these services, you can allow users to claim usernames, so that Space Daemon can know the public key of a given username and in that way share files via username without having to input public keys directly.

Authentication

Our hosted Textile Hub requires authentication via public key for logging in. This service sends a challenge to Space Daemon, which signs the challenge with the private key of the user and in that way our hosted Textile Hub can allow the user to store data.

Running from source

After cloning this repo, you can run it from source by running go run ./cmd/space-daemon -dev. Consider that you will need the following environment variables exported in your system:

IPFS_ADDR=[Your IPFS node address]
SERVICES_API_URL=[The URL where Space Services API is located]
VAULT_API_URL=[The URL where Space Vault API is located]
VAULT_SALT_SECRET=[A random string used for kdf functions before storing keys to the vault]
SERVICES_HUB_AUTH_URL=[The URL where Space Services Textile Hub Authorizer is located]
TXL_HUB_TARGET=[The URL of the Textile Hub]
TXL_HUB_MA=[The multiaddress for the Textile hub]
TXL_THREADS_TARGET=[The URL of the Textile Hub where Threads are hosted, can be the same that TXL_HUB_TARGET]

# NOTE: the following are required temporarily and will be removed once hub auth wrapper is setup
TXL_USER_KEY=[Space level key for hub access]
TXL_USER_SECRET=[Space level secret for hub access]

Alternatively, you can run make to compile the binary. Make sure you have these environment variables exposed though. You can see some example environment variables in .env.example.

Contributting

We are happy to receive issues and review pull requests. Please make sure to write tests for the code you are introducing and make sure it doesn't break already passing tests.

Read the following sections for an introduction into the code.

Package Structure

Loosely based on these resources:https://github.com/golang-standards/project-layout

  • /grpc Folder structure for gRPC and REST API.
  • /cmd Entry point directory for all binaries this repo handles. E.g cmd/{binary-name}/main.go
  • /config Global Config code
  • /core Directory for the core objects of the package
  • /logger Directory for app logging
  • /examples Directory playground for general examples and drafts

Main classes

  • ipfs: contains utils for general IPFS operations.
  • keychain: manages user public/private key pair.
  • libfuse: interoperates with FUSE for mounting drives.
  • space: contains the main integration from the services to the final Textile or FS operations.
  • store: contains a wrapper around a local db.
  • sync: keeps track of open files so that the updates get pushed to IPFS
  • textile: wrapper around Textile booting and operations

Generating Mocks

Mocks are generated using https://github.com/vektra/mockery.

For Linux it needs to be built from source.

mockery --name InterfaceToMock --dir path/to/go/files

Protobuf

If you update the gRPC API, you need to regenerate the Protobuf file.

You will need to install the following binaries in your Go path:

  • go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway

Checking the binaries:ls $GOPATH/binShould show the following binaries in your path: protoc-gen-go, protoc-gen-grpc-gateway

Run the protobuf generation:make proto_gen

Run the REST proxy generation:make gen_rest

** Ideally you should run make gen_all before commiting as this would run all the above three code generations andensure everything is up to date **

NOTE: See here for instructions on Reverse Proxy:https://github.com/grpc-ecosystem/grpc-gateway

Debugging, Profiling and Tracing

The following flags can be run with the binary to output profiling files for debugging.Flags support a full path to a file.-cpuprofile cpu.prof -memprofile mem.prof

By default, the binary runs in debug mode (this may change after release) and it boots a pprofserver in localhost:6060. See docs how to interact with pprof server here: https://github.com/google/pprof/blob/master/doc/README.md

To disable debug mode add this flag to binary arguments-debug=false

To enable trace in the daemon, pass -trace to the binary arguments. The daemon uses jaegarfor collecting trace information. Run make jaegar to quickly start a jaeger agent that collects the daemons trace information.You can http://localhost:16686/ to explore the web ui for traces collected.

CI Secrets

Secrets are set by adding them in Github and then specifying them in release.yml. Secrets can be constant across environment/stages or be stage specific.

If specified, the release file will dynamically generate the secret name based on the stage by adding a _DEV or _PRD suffix to the secret name only for the specificed environment variable. It will always use _PRD unless the tag ends in -dev. So for example tag v0.0.15 will use PRD values, while v0.0.15-dev will use DEV values.

Stage specific secret names will only be used for secrets in release.yml that point to the step output instead of the secret name directly (i.e., SERVICES_API_URL: ${{ secrets[steps.secretnames.outputs.SERVICES_API_URL] }} instead of SERVICES_API_URL: ${{ secrets.SERVICES_API_URL }}.

So to add a new secret:

  • If it's not stage specific then add the secret in GH with no suffix and in release.yml, refer to it based on the secret name.
  • If it is stage specific, then create the 2 secrets in GH (ending in _PRD and _DEV), add the entry in step secretnames, and make sure the secret name in the next step points to the step output
  • 使用apt install命令的错误信息如下所示 Use 'apt-get autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 228 not upgraded. 2 not fully installed or removed. After this operation, 0 B of additi

  • 这个现象发生在oracle用户,原因可能是我修改了oracle用户的ID导致 这时oracle的%HOME目录已经变成其他用户,因为ID乱了 这会导致用XMANAGER登陆oracle时直接退出 修改了HOME目录的用户后,可以用XMANAGER登陆,但是报标题的错误 cd /var/tmp rm -R *oracle* 重新进入,OK 来自 “ ITPUB博客 ” ,链接:http://blog

  • git-daemon是Git软件包中内置的Git服务器。 这是一个极简的Git服务器,没有权限控制,也没有Web控制台。 但是不需要安装额外的Git服务器,安装和使用非常方便,适合局域网内使用。 本文介绍如何在Archlinux下使用git-daemon。 Git-daemon 文档: https://git-scm.com/docs/git-daemon 启动Git服务器文档: https://

  • 昨天正常关机后,今早启动fedroa时,在登录界面提示"电源管理配置未正常启动,需要电脑管理员来解决“,试了一下ctrl+alt+F2还可以用,还不错,至少可以备份有用信息。对于这个问题,有人说需要yum update,于是进入ctrl+alt+F2,yum update再重新登录结果还是登录不了。还有说可以运行级别3,然后startx就OK了: ctrl+alt+F2 $/sbin/runlev

  • On Linux systems (where the ibus-daemon is active), there are scenarios where the IDE will stop responding to keyboard input or start inputting random characters. This document provides some workaroun

  • 升级Android Studio和Gradle之后,突然发现以下问题 Error:Unable to start the daemon process. This problem might be caused by incorrect configuration of the daemon. For example, an unrecognized jvm option is used. Ple

  • 1.修改kubelet配置(/etc/systemd/system/kubelet.service)后需要重启,报错Warning: kubelet.service changed on disk. Run 'systemctl daemon-reload' to reload units. 2.执行systemctl daemon-reload,未报错,然后执行systemctl restart

  • 1、简诉: idea引入gradle项目 出现堆空间耗尽Expiring Daemon because JVM heap space is exhausted Daemon will be stopped at 2、错误详情: Starting Gradle Daemon... Gradle Daemon started in 1 s 569 ms > Task :prepareKotlin

  • 参考:https://www.jianshu.com/p/82e66800baf3 使用grade编译apk时报错:Expiring Daemon because JVM heap space is exhausted 报错原因:  jvm 默认可分配的堆内存不够 解决方案: 在 gradle.properties 文件中添加 org.gradle.jvmargs=-Xmx4096m -XX:Ma

  • 遇到的错误:react-native android打包失败: Expiring daemon because jvm heap space is exhausted 解决方法:在android->gradle.properties文件下添加下列代码 #开启线程守护,第一次编译时开线程,之后就不会再开了 org.gradle.daemon=true #配置编译时的虚拟机大小 org.gradle.

 相关资料
  • 描述 (Description) 合并空间功能通过空间添加属性值。 例子 (Example) 以下示例演示了在LESS文件中使用合并空间功能 - <!doctype html> <head> <title>Merge Space</title> <link rel = "stylesheet" href = "style.css" type = "text/css"

  • Space函数填充具有特定数量空格的字符串。 语法 (Syntax) space(number) 参数描述 (Parameter Description) Number - 必需参数。 我们要添加到给定字符串的空格数。 例子 (Example) Private Sub Constant_demo_Click() Dim var1 as Variant var1 = "Microsof

  • 描述 (Description) white-space属性用于更改用户代理处理元素中的空格。 可能的值 (Possible Values) normal - 元素中的任何空格序列都将转换为单个空格。 pre - 元素中的所有空格都被尊重,包括多个空格和回车。 nowrap - 元素中的任何空格序列都将转换为单个空格,但禁用自动换行。 适用于 (Applies to) 所有块级元素。 DOM语法

  • 描述 (Description) 字符类\p{Space}匹配任何空格字符。 例子 (Example) 以下示例显示了Posix字符类匹配的用法。 package com.wenjiangs; import java.util.regex.Matcher; import java.util.regex.Pattern; public class PosixCharacterClassDemo {

  • 创建空间 修改空间 删除空间

  • Space SDK Javascript/Typescript library for interacting with Space in web/browser applications via an implementation of the Space API. Build websites or applications that can easily leverage Open Web