You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: gluster.go
    path of file: ./repos/juicefs/pkg/object
    
    the code of the file until where you have to start completion: //go:build gluster
// +build gluster

/*
 * JuiceFS, Copyright 2023 Juicedata, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distribu
    
func newGluster(endpoint, ak, sk, token string) (ObjectStorage, error) {
	if !strings.Contains(endpoint, "://") {
		endpoint = fmt.Sprintf("gluster://%s", endpoint)
	}
	uri, err := url.ParseRequestURI(endpoint)
	if err != nil {
		return nil, fmt.Errorf("Invalid endpoint %s: %s", endpoint, err)
	}
	ps := strings.Split(uri.Path, "/")
	if len(ps) == 1 {
		return nil, fmt.Errorf("no volume provided")
	}
	name := ps[1]
	// multiple clinets for possible performance improvement
	var size int
	if ssize := os.Getenv("JFS_NUM_GLUSTER_CLIENTS"); ssize != "" {
		size, _ = strconv.Atoi(ssize)
		if size > 8 {
			size = 8
		}
	}
	if size < 1 {
		size = 1
	}
	// logging
	level := gfapi.LogInfo
	if slevel := os.Getenv("JFS_GLUSTER_LOG_LEVEL"); slevel != "" {
		switch strings.ToUpper(slevel) {
		case "ERROR":
			level = gfapi.LogError
		case "WARN", "WARNING":
			level = gfapi.LogWarning
		case "INFO":
			level = gfapi.LogInfo
		case "DEBUG":
			level = gfapi.LogDebug
		case "TRACE":
			level = gfapi.LogTrace
		}
	}
	logPath := os.Getenv("JFS_GLUSTER_LOG_PATH")
	hosts := strings.Split(uri.Host, ",")
	pid := os.Getpid()
	ostore := gluster{
		name: name,
		vols: make([]*gfapi.Volume, size),
	}
	for i := range ostore.vols {
		v := &gfapi.Volume{}
		// TODO: support port in host
		err = v.Init(name, hosts...)
		if err != nil {
			return nil, fmt.Errorf("init %s: %s", name, err)
		}
		if logPath == "" {
			err = v.SetLogging(fmt.Sprintf("/var/log/glusterfs/%s-%s-%d-%d.log", hosts[0], name, pid, i), level)
		} else {
			err = v.SetLogging(logPath, level)
		}
		if err != nil {
			logger.Warnf("Set gluster logging for vol %s: %s", name, err)
		}
		err = v.Mount()
		if err != nil {
			return nil, fmt.Errorf("mount %s: %s", name, err)
		}
		ostore.vols[i] = v
	}
	return &ostore, nil
}