customer

package
v2.0.6+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package customer is responsible for constructing customer upload objects to handle deduplicated storage billing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager is used to handle managing customer objects

func NewManager

func NewManager(um *models.UserManager, ipfs rtfs.Manager) *Manager

NewManager is used to instantiate our customer object manager

func (*Manager) GetDeduplicatedStorageSpaceInBytes

func (m *Manager) GetDeduplicatedStorageSpaceInBytes(username, hash string) (int, error)

GetDeduplicatedStorageSpaceInBytes is used to get the deduplicated storage space used by this particular hash. It calculates deduplicated storage costs based on previous uploads the user has made, and does not consider upload from other users. it is a read-only operation, and returns the storage space that will be used by this upload

func (*Manager) Update

func (m *Manager) Update(username, hash string) (string, error)

Update is used to update a customers deduplicated storage object

type Object

type Object struct {
	// UploadedRefs is a map used to check whether or not a particular link ref has been uploaded
	// the only time this value is populated is when an ipld objecct (say a folder) is uploaded, all
	// the links of the folder will fill this map
	UploadedRefs map[string]bool `json:"uploaded_nodes"`
	// UploadedRootNodes is a map used to check whether or not a particular entire root node has been uploaded.
	// each upload will always count as an uploaded root node however only ipld objects that contain links will also go to uploaded refs
	UploadedRootNodes map[string]bool `json:"uploaded_root_nodes"`
}

Object represents a single customer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL