1eade4ae58
This introduces a pin/update operation which allows to Pin a new item to cluster indicating that said pin is an update to an already-existing pin. When this is the case, all the configuration for the existing pin is copied to the new one (including allocations). The IPFS connector will then trigger pin/update directly in IPFS, allowing an efficient pinning based on DAG-differences. Since the allocations where the same for both pins, the pin/update can proceed. PinUpdate does not unpin the previous pin (it is not possible to do this atomically in cluster like it happens in IPFS). The user can manually do it after the pin/update is done. Internally, after a lot of deliberations on what the optimal way for this is, I opted for adding a `PinUpdate` option to the `PinOptions` type (carries the CID to update from). In order to carry this option from the REST API to the IPFS Connector, it is serialized in the Protobuf (and stored in the datastore). There is no other way to do this in a simple fashion since the Pin object is piece of information that is sent around. Additionally, making it a PinOption plays well with the Pin/PinPath APIs which need little changes. Effectively, you are pinning a new thing. You are just indicating that it should be configured from an existing one. Fixes #732
252 lines
8.5 KiB
Go
252 lines
8.5 KiB
Go
// Code generated by protoc-gen-go. DO NOT EDIT.
|
|
// source: types.proto
|
|
|
|
package api_pb
|
|
|
|
import (
|
|
fmt "fmt"
|
|
proto "github.com/golang/protobuf/proto"
|
|
math "math"
|
|
)
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ = proto.Marshal
|
|
var _ = fmt.Errorf
|
|
var _ = math.Inf
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the proto package it is being compiled against.
|
|
// A compilation error at this line likely means your copy of the
|
|
// proto package needs to be updated.
|
|
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
|
|
|
type Pin_PinType int32
|
|
|
|
const (
|
|
Pin_BadType Pin_PinType = 0
|
|
Pin_DataType Pin_PinType = 1
|
|
Pin_MetaType Pin_PinType = 2
|
|
Pin_ClusterDAGType Pin_PinType = 3
|
|
Pin_ShardType Pin_PinType = 4
|
|
)
|
|
|
|
var Pin_PinType_name = map[int32]string{
|
|
0: "BadType",
|
|
1: "DataType",
|
|
2: "MetaType",
|
|
3: "ClusterDAGType",
|
|
4: "ShardType",
|
|
}
|
|
|
|
var Pin_PinType_value = map[string]int32{
|
|
"BadType": 0,
|
|
"DataType": 1,
|
|
"MetaType": 2,
|
|
"ClusterDAGType": 3,
|
|
"ShardType": 4,
|
|
}
|
|
|
|
func (x Pin_PinType) String() string {
|
|
return proto.EnumName(Pin_PinType_name, int32(x))
|
|
}
|
|
|
|
func (Pin_PinType) EnumDescriptor() ([]byte, []int) {
|
|
return fileDescriptor_d938547f84707355, []int{0, 0}
|
|
}
|
|
|
|
type Pin struct {
|
|
Cid []byte `protobuf:"bytes,1,opt,name=Cid,proto3" json:"Cid,omitempty"`
|
|
Type Pin_PinType `protobuf:"varint,2,opt,name=Type,proto3,enum=api.pb.Pin_PinType" json:"Type,omitempty"`
|
|
Allocations [][]byte `protobuf:"bytes,3,rep,name=Allocations,proto3" json:"Allocations,omitempty"`
|
|
MaxDepth int32 `protobuf:"zigzag32,4,opt,name=MaxDepth,proto3" json:"MaxDepth,omitempty"`
|
|
Reference []byte `protobuf:"bytes,5,opt,name=Reference,proto3" json:"Reference,omitempty"`
|
|
Options *PinOptions `protobuf:"bytes,6,opt,name=Options,proto3" json:"Options,omitempty"`
|
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
XXX_unrecognized []byte `json:"-"`
|
|
XXX_sizecache int32 `json:"-"`
|
|
}
|
|
|
|
func (m *Pin) Reset() { *m = Pin{} }
|
|
func (m *Pin) String() string { return proto.CompactTextString(m) }
|
|
func (*Pin) ProtoMessage() {}
|
|
func (*Pin) Descriptor() ([]byte, []int) {
|
|
return fileDescriptor_d938547f84707355, []int{0}
|
|
}
|
|
|
|
func (m *Pin) XXX_Unmarshal(b []byte) error {
|
|
return xxx_messageInfo_Pin.Unmarshal(m, b)
|
|
}
|
|
func (m *Pin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
return xxx_messageInfo_Pin.Marshal(b, m, deterministic)
|
|
}
|
|
func (m *Pin) XXX_Merge(src proto.Message) {
|
|
xxx_messageInfo_Pin.Merge(m, src)
|
|
}
|
|
func (m *Pin) XXX_Size() int {
|
|
return xxx_messageInfo_Pin.Size(m)
|
|
}
|
|
func (m *Pin) XXX_DiscardUnknown() {
|
|
xxx_messageInfo_Pin.DiscardUnknown(m)
|
|
}
|
|
|
|
var xxx_messageInfo_Pin proto.InternalMessageInfo
|
|
|
|
func (m *Pin) GetCid() []byte {
|
|
if m != nil {
|
|
return m.Cid
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *Pin) GetType() Pin_PinType {
|
|
if m != nil {
|
|
return m.Type
|
|
}
|
|
return Pin_BadType
|
|
}
|
|
|
|
func (m *Pin) GetAllocations() [][]byte {
|
|
if m != nil {
|
|
return m.Allocations
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *Pin) GetMaxDepth() int32 {
|
|
if m != nil {
|
|
return m.MaxDepth
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (m *Pin) GetReference() []byte {
|
|
if m != nil {
|
|
return m.Reference
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *Pin) GetOptions() *PinOptions {
|
|
if m != nil {
|
|
return m.Options
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type PinOptions struct {
|
|
ReplicationFactorMin int32 `protobuf:"zigzag32,1,opt,name=ReplicationFactorMin,proto3" json:"ReplicationFactorMin,omitempty"`
|
|
ReplicationFactorMax int32 `protobuf:"zigzag32,2,opt,name=ReplicationFactorMax,proto3" json:"ReplicationFactorMax,omitempty"`
|
|
Name string `protobuf:"bytes,3,opt,name=Name,proto3" json:"Name,omitempty"`
|
|
ShardSize uint64 `protobuf:"varint,4,opt,name=ShardSize,proto3" json:"ShardSize,omitempty"`
|
|
Metadata map[string]string `protobuf:"bytes,6,rep,name=Metadata,proto3" json:"Metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
|
PinUpdate []byte `protobuf:"bytes,7,opt,name=PinUpdate,proto3" json:"PinUpdate,omitempty"`
|
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
XXX_unrecognized []byte `json:"-"`
|
|
XXX_sizecache int32 `json:"-"`
|
|
}
|
|
|
|
func (m *PinOptions) Reset() { *m = PinOptions{} }
|
|
func (m *PinOptions) String() string { return proto.CompactTextString(m) }
|
|
func (*PinOptions) ProtoMessage() {}
|
|
func (*PinOptions) Descriptor() ([]byte, []int) {
|
|
return fileDescriptor_d938547f84707355, []int{1}
|
|
}
|
|
|
|
func (m *PinOptions) XXX_Unmarshal(b []byte) error {
|
|
return xxx_messageInfo_PinOptions.Unmarshal(m, b)
|
|
}
|
|
func (m *PinOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
return xxx_messageInfo_PinOptions.Marshal(b, m, deterministic)
|
|
}
|
|
func (m *PinOptions) XXX_Merge(src proto.Message) {
|
|
xxx_messageInfo_PinOptions.Merge(m, src)
|
|
}
|
|
func (m *PinOptions) XXX_Size() int {
|
|
return xxx_messageInfo_PinOptions.Size(m)
|
|
}
|
|
func (m *PinOptions) XXX_DiscardUnknown() {
|
|
xxx_messageInfo_PinOptions.DiscardUnknown(m)
|
|
}
|
|
|
|
var xxx_messageInfo_PinOptions proto.InternalMessageInfo
|
|
|
|
func (m *PinOptions) GetReplicationFactorMin() int32 {
|
|
if m != nil {
|
|
return m.ReplicationFactorMin
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (m *PinOptions) GetReplicationFactorMax() int32 {
|
|
if m != nil {
|
|
return m.ReplicationFactorMax
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (m *PinOptions) GetName() string {
|
|
if m != nil {
|
|
return m.Name
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *PinOptions) GetShardSize() uint64 {
|
|
if m != nil {
|
|
return m.ShardSize
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (m *PinOptions) GetMetadata() map[string]string {
|
|
if m != nil {
|
|
return m.Metadata
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PinOptions) GetPinUpdate() []byte {
|
|
if m != nil {
|
|
return m.PinUpdate
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func init() {
|
|
proto.RegisterEnum("api.pb.Pin_PinType", Pin_PinType_name, Pin_PinType_value)
|
|
proto.RegisterType((*Pin)(nil), "api.pb.Pin")
|
|
proto.RegisterType((*PinOptions)(nil), "api.pb.PinOptions")
|
|
proto.RegisterMapType((map[string]string)(nil), "api.pb.PinOptions.MetadataEntry")
|
|
}
|
|
|
|
func init() { proto.RegisterFile("types.proto", fileDescriptor_d938547f84707355) }
|
|
|
|
var fileDescriptor_d938547f84707355 = []byte{
|
|
// 391 bytes of a gzipped FileDescriptorProto
|
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0xcd, 0x8e, 0xd3, 0x30,
|
|
0x10, 0xc6, 0x49, 0x9a, 0x34, 0x93, 0xee, 0xaa, 0x3b, 0xec, 0xc1, 0x5a, 0x71, 0xb0, 0x7a, 0x21,
|
|
0x07, 0x94, 0x43, 0xb8, 0x20, 0xe0, 0xb2, 0x6c, 0x01, 0x09, 0xa9, 0x50, 0x79, 0xe9, 0x03, 0xb8,
|
|
0x8d, 0x51, 0x2d, 0x42, 0x62, 0xa5, 0x2e, 0x6a, 0x78, 0x1b, 0x1e, 0x86, 0xf7, 0x42, 0xb6, 0xfb,
|
|
0x87, 0xe8, 0x21, 0xd2, 0x7c, 0xdf, 0xcc, 0xe7, 0x99, 0xf9, 0x32, 0x90, 0x99, 0x5e, 0xcb, 0x4d,
|
|
0xa1, 0xbb, 0xd6, 0xb4, 0x18, 0x0b, 0xad, 0x0a, 0xbd, 0x9c, 0xfc, 0x0e, 0x20, 0x9c, 0xab, 0x06,
|
|
0xc7, 0x10, 0x3e, 0xa8, 0x8a, 0x12, 0x46, 0xf2, 0x11, 0xb7, 0x21, 0x3e, 0x87, 0xe8, 0x6b, 0xaf,
|
|
0x25, 0x0d, 0x18, 0xc9, 0xa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