Show HN: 菌丝体
Show HN: Mycelium

原始链接: https://github.com/mycweb/mycelium

Mycelium是一个用于存储和传输类型化数据的系统,支持标准数据类型以及引用、表达式、函数和类型等高级特性。每个Mycelium值都有一个类型,值可以通过表达式计算,由Mycelium虚拟机(MVM)进行评估。 MVM具有Go语言的参考实现,它操作不可变的值,并使用端口上的输入、输出和交互操作进行进程间通信。它利用硬件加速来执行常用函数。 MycZip允许将单个Mycelium值(可能包含许多嵌套值)存储为文件。Mycelium网络协议(MNP)是一个基于QUIC的点对点协议,用于传输Mycelium值,并将其缓存以最大限度地减少数据传输。所有参与方都使用表示为Mycelium值的加密身份进行身份验证。 基质(Substrates)存储Mycelium值并执行MVM计算。Spore是一种为MVM设计的编程语言,专注于以易于阅读的语法定义Mycelium值。

Mycelium 是一种新型序列化格式,旨在解决与 Protocol Buffers 和 JSON 类似的问题。它基于比特构建,其中所有内容,从字节到字符串和整数,都表示为比特数组或列表。除了典型的序列化之外,Mycelium 还支持跨网络发送过程(Lambda),这需要机器码规范和抽象机器模型。其关键特性包括和类型(Coproduct)和加密指针 (Refs) 用于安全的数据处理。 潜在应用包括: * 数据存储和传输的序列化格式。 * 用于安全运行不受信任代码的虚拟机 (VM)。 * 编程语言(如 Spore)的编译目标。 * 用于密码学签名数据结构(Merkle 树)的格式。 * 通过加密指针高效同步大型数据结构的机制。

原文

Mycelium is a set of typed formats for storing and transferring data. As you might expect it supports things like:

But as you might not expect, it also has support for:

  • Refs (pointers)
  • Expressions
  • Functions/Procedures
  • Types

Every value that you can specify in Mycelium has a Type (which is also a Value), and every Value can be stored or transferred. Values can be computed by evaluating Expressions. Expressions are also Values and can also be stored or transferred.

The Mycelium Virtual Machine (MVM) is an abstract machine model that defines what it means for a Mycelium Expression to be evaluated. It is not necessary to have an MVM implementation in order to send and receive Mycelium Values. A reference implementation of the MVM, written in Go, is available in the mvm1 directory.

Here are some fast facts about the MVM:

  • All Values in the MVM are immutable.
  • The MVM models interprocess interactions as operations {Input, Output, Interact} on special Values called Ports. These are the only operations with effects.
  • Since all Values can be fingerprinted in constant time, it is very easy to add accelerators for known functions. e.g. the MVM has no addition operation, but a cannonical addition function is accelerated using the hardware's addition instruction.
  • The MVM operations are defined in spec/op.go. The design favors a small amount of powerful operations over a large amount.

You can read more about the MVM here.

MycZip is a format for encoding Mycelium values so they may exist in a filesystem as a single file. A single MycZip file can hold a single Mycelium Value. This is hardly a limitation, since that Value can be an Array or Product, and transitively include as many other Values as desired.

The Mycelium Network Protocol (MNP) is a protocol for transferring Mycelium Values over the network between Peers.

Built on QUIC, it is a peer-to-peer message passing protocol, with support for Ask and Tell semantics on messages containing Mycelium Values. All parties are authenticated in MNP, and the cryptographic identity of each party has a cannonical representation as a Mycelium Value (called a Peer).

MNP caches all transferred values, and only Values not available locally will be transferred. e.g. If you send a lot of strings, you will only have to send the type for a String (cannonically List[Array[Bit, 8]]) the first time, and then never again.

You can read more about the MNP here.

A substrate is something that stores Mycelium Values and can perform computations on them according to the MVM.

A substrate, written in Go, is available in the mycss/ directory.

Spore is a programming language targetting the MVM. It is a data oriented language, where the emphasis is on defining Mycelium Values in a human-readable syntax.

You can read more about Spore here

联系我们 contact @ memedata.com