filesystem

package
v0.0.0-...-b893f88 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

README

Simple Distributed File System

Our simple distributed file system (SDFS) provides fault-tolerant distributed file system services with fast time-bounded write-write conflicts. It is built on top of our distributed group membership service, where each member in the group is placed on an extended virtual ring sorted by their IDs.

Replication

We use a replication factor (RF) of 4 to tolerate up to three machine failures at a time. We do not shard the files and always replicate an entire file. There is no master node involved. Each node stores the full file-to-machine mapping table and directly contacts the machines with the file to perform read/write. A quorum-based consensus method is used to provide fast response time but still ensures strong consistency. We use a read replica count (R) of 1 and a write replica count (W) of 4, so that W + R > RF and W > RF/2. When a node leaves the group or fails, the distributed group membership service will notify the SDFS. For each file stored on the left/failed node, the node with the smallest id among the nodes storing the file will be selected to carry out re-replication on randomly selected nodes without the file. The random selection of nodes can reduce the chance of having uneven file storage distribution.

Time-bounded write-write conflicts

A modified version of Maekawa's algorithm is used to provide time-bounded write-write conflicts. Each write operation will broadcast to request write permission from each node. If a node finds that the last write to the same file (if exists) does not take place within a minute ago, it grants permission to the request and updates the last write time, otherwise it rejects the request. If a write operation receives a quorum of permissions, it is approved, otherwise confirmation from the user is required. If no confirmation is received within 30 s, the write operation is automatically rejected.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Args

type Args struct {
	Filename  string
	Content   string // can be empty
	Timestamp string // can be empty
}

Args is a joint representation of arguments for RPCs

type FileSystemService

type FileSystemService struct {
	Ms *M.MembershipService

	IsMaster        bool        // am I the master of MapleJuice?
	LeaveReportChan chan string // leave report channel
	FailReportChan  chan string // failure report channel
	JoinReportChan  chan string // join report channel
	// contains filtered or unexported fields
}

FileSystemService provides distributed file management services

func (*FileSystemService) Contains

func (fs *FileSystemService) Contains(file string) bool

Contains checks if a file is contained in SDFS

func (*FileSystemService) Delete

func (fs *FileSystemService) Delete(sdfsfilename string) error

Delete erases the SDFS file

func (*FileSystemService) Get

func (fs *FileSystemService) Get(sdfsfilename string, localfilename string) error

Get retrieves the SDFS file and stores it in the local file

func (*FileSystemService) HandleDelete

func (fs *FileSystemService) HandleDelete(args Args, reply *string) error

HandleDelete handles a remote delete file request

func (*FileSystemService) HandleFileMetaData

func (fs *FileSystemService) HandleFileMetaData(args *Args, reply *int) error

HandleFileMetaData sends meta data of SDFS to newly joined nodes

func (*FileSystemService) HandleGet

func (fs *FileSystemService) HandleGet(args *Args, reply *string) error

HandleGet handles a remote get file request

func (*FileSystemService) HandleInsert

func (fs *FileSystemService) HandleInsert(args Args, reply *string) error

HandleInsert handles a remote insert file request

func (*FileSystemService) HandleInsertBroadcast

func (fs *FileSystemService) HandleInsertBroadcast(args Args, reply *int) error

HandleInsertBroadcast handles a remote broadcast of file inserted info request

func (*FileSystemService) HandleRequestToken

func (fs *FileSystemService) HandleRequestToken(args Args, reply *int) error

HandleRequestToken handles token request for mutual exclusive file writes

func (*FileSystemService) HandleUpdate

func (fs *FileSystemService) HandleUpdate(args *Args, reply *int) error

HandleUpdate handles a remote update file request

func (*FileSystemService) ListAllFiles

func (fs *FileSystemService) ListAllFiles() []string

ListAllFiles lists all files stored in SDFS

func (*FileSystemService) ListFiles

func (fs *FileSystemService) ListFiles() ([]string, error)

ListFiles lilsts all files currently being stored at this machine

func (*FileSystemService) ListMachines

func (fs *FileSystemService) ListMachines(sdfsfilename string) ([]string, error)

ListMachines lists all machine addresses where this file is currently being stored

func (*FileSystemService) PrePut

func (fs *FileSystemService) PrePut(sdfsfilename string) error

PrePut achieves mutual exclusion before the real put

func (*FileSystemService) Put

func (fs *FileSystemService) Put(localfilename string, sdfsfilename string) error

Put inserts or updates the SDFS file with the local file

func (*FileSystemService) StartService

func (fs *FileSystemService) StartService(ms *M.MembershipService) error

StartService starts file system service

Jump to

Keyboard shortcuts

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