Beispiel #1
0
// New initializes a new TagsFs that uses the given AWS client
func New(client *ec2.EC2, instanceID string) *TagsFs {
	return &TagsFs{
		FileSystem: pathfs.NewReadonlyFileSystem(pathfs.NewDefaultFileSystem()),
		Client:     client,
		InstanceID: instanceID,
	}
}
Beispiel #2
0
func New(config *conf.Fuse, logger log_driver.Logger) (*GitFs, error) {
	gitfsDir, err := gitfsDir(logger)
	if err != nil {
		return nil, err
	}

	defaultfs := pathfs.NewDefaultFileSystem()
	gitfs := &GitFs{FileSystem: pathfs.NewReadonlyFileSystem(defaultfs), GitRepoDir: config.GitRepoDir, GitFsDir: gitfsDir, logger: logger}
	fs := pathfs.NewPathNodeFs(gitfs, nil)
	server, _, err := nodefs.MountRoot(gitfsDir, fs.Root(), nil)
	if err != nil {
		logger.Errorf("Failed to mount GitFS on %s due to %s", gitfsDir, err)
		return nil, err
	}
	logger.Debugf("Mount GitFs on %s", gitfsDir)
	gitfs.server = server
	server.SetDebug(config.Debug)

	gitfs.cache, err = cache.New(1024)
	if err != nil {
		logger.Errorf("Failed to initialize object cache due to %s\n", err)
		return nil, err
	}

	return gitfs, nil
}
Beispiel #3
0
// New initializes a new MetadataFs that uses the given endpoint as the
// target of metadata requests
func New(endpoint string) *MetadataFs {
	return &MetadataFs{
		FileSystem: pathfs.NewReadonlyFileSystem(pathfs.NewDefaultFileSystem()),
		Client:     &http.Client{},
		Endpoint:   endpoint,
	}
}
Beispiel #4
0
// NewKeywhizFs readies a KeywhizFs struct and its parent filesystem objects.
func NewFs(client *api.Client, owner keywhizfs.Ownership) (*fs, nodefs.Node) {
	defaultfs := pathfs.NewDefaultFileSystem()            // Returns ENOSYS by default
	readonlyfs := pathfs.NewReadonlyFileSystem(defaultfs) // R/W calls return EPERM

	kwfs := &fs{readonlyfs, client, owner}
	nfs := pathfs.NewPathNodeFs(kwfs, nil)
	nfs.SetDebug(true)
	return kwfs, nfs.Root()
}
Beispiel #5
0
// NewKeywhizFs readies a KeywhizFs struct and its parent filesystem objects.
func NewKeywhizFs(client *Client, ownership Ownership, timeouts Timeouts, logConfig log.Config) (kwfs *KeywhizFs, root nodefs.Node, err error) {
	logger := log.New("kwfs", logConfig)
	cache := NewCache(client, timeouts, logConfig)

	defaultfs := pathfs.NewDefaultFileSystem()            // Returns ENOSYS by default
	readonlyfs := pathfs.NewReadonlyFileSystem(defaultfs) // R/W calls return EPERM

	kwfs = &KeywhizFs{readonlyfs, logger, client, cache, time.Now(), ownership}
	nfs := pathfs.NewPathNodeFs(kwfs, nil)
	nfs.SetDebug(logConfig.Debug)
	return kwfs, nfs.Root(), nil
}