storj/lib/uplink/main.go
Dylan Lott 6bf46e80ee
Adds Libuplink (#1452)
* Merge in upstream

* Some initial wireup

* Added common.go file, more misc. work

* WIP adding identity in

* Get FullIdentity combined into Uplink

* Structure libuplink a little better

* Update some types and add some comments

* WIP uplink stuff

* Get uplink types and configs figured out

* add initial setup for tests, happy path is working

* Remove dependency from miniogw

* Adds miniogw code and wires it up correctly

* WIP working on getting test suite setup

* Uplink client now returns successfully and passes some initial happy path tets

* WIP trying to get v2 draft ready

* WIP

* WIP wiring up bucket methods and adjusting to some review feedback

* Getting closer to v2 libuplink draft

* CreateBucket now works and has tests to prove it

* Bucket tests are passing now

* removing some code

* Updates error handling and linter fixes

* Removes main_test

* Uploads and downloads are now working

* Rename BucketOpts to Encryption

* updates

* added test file back to git that was being ignored for some reason

* more test conditions

* changes Checksum in ObjectMeta struct to be type []byte

* linter fix

* Updates how encryption is passed through to bucket opts

* Updates encryption handling at bucket and access level

* Fixes imports

* Updates per code review
2019-03-20 09:43:53 -06:00

38 lines
990 B
Go

// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information.
package uplink
import (
"context"
"storj.io/storj/pkg/identity"
ul "storj.io/storj/uplink"
)
// Uplink represents the main entrypoint to Storj V3. An Uplink connects to
// a specific Satellite and caches connections and resources, allowing one to
// create sessions delineated by specific access controls.
type Uplink struct {
id *identity.FullIdentity
satelliteAddr string
config ul.Config
}
// Access returns a pointer to an Access for bucket operations to occur on
func (u *Uplink) Access(ctx context.Context, permissions Permissions) *Access {
// TODO (dylan): Parse permissions here
return &Access{
Uplink: u,
}
}
// NewUplink returns a pointer to a new Uplink or an error
func NewUplink(identity *identity.FullIdentity, satelliteAddr string, cfg ul.Config) *Uplink {
return &Uplink{
id: identity,
satelliteAddr: satelliteAddr,
config: cfg,
}
}