Created
July 29, 2017 16:27
-
-
Save starius/20e1a109ff845f3901b29ec90c409d82 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package api | |
type Files interface { | |
Open(name string, existing bool, write, read bool, replication string) (int64, error) | |
Close(fd int64) error | |
SizeOf(fd int64) (int64, error) | |
Append(fd int64, data []byte) error | |
ReadAt(fd int64, offset int64, size int) ([]byte, error) | |
List() (map[string]int64, error) | |
Delete(name string) error | |
} | |
type SectorManager interface { | |
ReadSector(i int64) ([]byte, error) | |
InsecureReadSectorAt(i int64, offset, length int) ([]byte, error) | |
AllocateSector() (int64, error) | |
WriteSector(i int64, data []byte, replication string) error | |
Delete(i int64) error | |
} | |
type HostIO interface { | |
Read(contractID, sectorRoot string, sectorID int64) ([]byte, error) | |
Write(contractID string, data []byte, sectorID int64) (string, error) | |
Update(contractID string, data []byte, sectorID int64, oldSectorRoot string) (string, error) | |
} | |
type Contractor interface { | |
Contracts() ([]string, error) | |
// Data from hostdb. Important missibg piece of data: latencies. | |
ConcludeContract(host string, duration int) (string, error) | |
RenewContract(contractID string) (string, error) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment