Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Latest commit

 

History

History
68 lines (43 loc) · 2.51 KB

86-add-create-link-operation.md

File metadata and controls

68 lines (43 loc) · 2.51 KB

GSP-86: Add Create Link Operation

Background

We have ModeLink for Object which means this Object is a link which targets to another Object. A link object could be returned in Stat or List. But there is no way to create a link object.

As discussed in Link / Symlink support, link related support is very different in different services:

Proposal

I propose to add a new CreateLink operation:

type Linker interface {
	CreateLink(path, target string, pairs ...Pair) (o *Object, err error)
}
  • path is the path of link object.
    • path COULD be relative or absolute path
  • target is the target path of this link object.
    • target COULD be relative or absolute path

As described in GSP-87, CreateLink could also be virtual functions.

  • Service without native support COULD implement virtual_link feature.
  • Users SHOULD enable this feature by themselves.

Rationale

Hardlink & Symlink

We will only support Symlink and simplify it to Link instead.

Data corruption issue

A service doesn't have native support for Link, so we implement one for it. After few months, the service supports it.

How to handle old-style objects? How to avoid data corruption

The feature gates will be kept until next major release.

  • If user enabled virtual_link, service SHOULD run compatible mode: create link via native methods, but allow read link from old-style link object.
  • If user didn't enable virtual_link, service will run in native as other services.

Finally, those compatible code will be removed in next major release, and virtual_link feature will be removed.

Compatibility

This proposal is compatible.

Implementation

  • Add new operations and new features in specs
  • Implement integration test
  • Implement Linker for services