func (log *fileLog) Create() (WriteSegment, error) {
	filename := filepath.Join(log.root, fmt.Sprintf("%s%s", uuid.New(), extActive))
	f, err := log.filesys.Create(filename)
	if err != nil {
		return nil, err
	}
	return fileWriteSegment{log.filesys, f}, nil
}
Create returns a new writable segment.
package ingest
import (
	"fmt"
	"os"
	"path/filepath"
	"time"
	"github.com/pborman/uuid"
	"github.com/pkg/errors"
	"github.com/1046102779/oklog/pkg/fs"
)
const (
	extActive  = ".active"
	extFlushed = ".flushed"
	extPending = ".pending"
	lockFile = "LOCK"
)
func NewFileLog(filesys fs.Filesystem, root string) (Log, error) {
	if err := filesys.MkdirAll(root); err != nil {
		return nil, errors.Wrapf(err, "creating path %s", root)
	}
	lock := filepath.Join(root, lockFile)
	r, existed, err := filesys.Lock(lock)
	if err != nil {
		return nil, errors.Wrapf(err, "locking %s", lock)
	}
	if existed {
	}
	if err := recoverSegments(filesys, root); err != nil {
		return nil, errors.Wrap(err, "during recovery")
	}
	return &fileLog{
		root:     root,
		filesys:  filesys,
		releaser: r,
	}, nil
}
type fileLog struct {
	root     string
	filesys  fs.Filesystem
	releaser fs.Releaser
}