
- Add a new type PortworxVolumeSource - Implement the kubernetes volume plugin for Portworx Volumes under pkg/volume/portworx - The Portworx Volume Driver uses the libopenstorage/openstorage specifications and apis for volume operations. Changes for k8s configuration and examples for portworx volumes. - Add PortworxVolume hooks in kubectl, kube-controller-manager and validation. - Add a README for PortworxVolume usage as PVs, PVCs and StorageClass. - Add example spec files Handle code review comments. - Modified READMEs to incorporate to suggestions. - Add a test for ReadWriteMany access mode. - Use util.UnmountPath in TearDown. - Add ReadOnly flag to PortworxVolumeSource - Use hostname:port instead of unix sockets - Delete the mount dir in TearDown. - Fix link issue in persistentvolumes README - In unit test check for mountpath after Setup is done. - Add PVC Claim Name as a Portworx Volume Label Generated code and documentation. - Updated swagger spec - Updated api-reference docs - Updated generated code under pkg/api/v1 Godeps update for Portworx Volume Driver - Adds github.com/libopenstorage/openstorage - Adds go.pedge.io/pb/go/google/protobuf - Updates Godep Licenses
68 lines
1.4 KiB
Go
68 lines
1.4 KiB
Go
package google_protobuf
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
var (
|
|
// EmptyInstance is an instance of Empty.
|
|
EmptyInstance = &Empty{}
|
|
)
|
|
|
|
// Now returns the current time as a protobuf Timestamp.
|
|
func Now() *Timestamp {
|
|
return TimeToProto(time.Now().UTC())
|
|
}
|
|
|
|
// TimeToProto converts a go Time to a protobuf Timestamp.
|
|
func TimeToProto(t time.Time) *Timestamp {
|
|
return &Timestamp{
|
|
Seconds: t.UnixNano() / int64(time.Second),
|
|
Nanos: int32(t.UnixNano() % int64(time.Second)),
|
|
}
|
|
}
|
|
|
|
// GoTime converts a protobuf Timestamp to a go Time.
|
|
func (t *Timestamp) GoTime() time.Time {
|
|
if t == nil {
|
|
return time.Unix(0, 0).UTC()
|
|
}
|
|
return time.Unix(
|
|
t.Seconds,
|
|
int64(t.Nanos),
|
|
).UTC()
|
|
}
|
|
|
|
// Before returns true if t is before j.
|
|
func (t *Timestamp) Before(j *Timestamp) bool {
|
|
if j == nil {
|
|
return false
|
|
}
|
|
if t == nil {
|
|
return true
|
|
}
|
|
if t.Seconds < j.Seconds {
|
|
return true
|
|
}
|
|
if t.Seconds > j.Seconds {
|
|
return false
|
|
}
|
|
return t.Nanos < j.Nanos
|
|
}
|
|
|
|
// DurationToProto converts a go Duration to a protobuf Duration.
|
|
func DurationToProto(d time.Duration) *Duration {
|
|
return &Duration{
|
|
Seconds: int64(d) / int64(time.Second),
|
|
Nanos: int32(int64(d) % int64(time.Second)),
|
|
}
|
|
}
|
|
|
|
// GoDuration converts a protobuf Duration to a go Duration.
|
|
func (d *Duration) GoDuration() time.Duration {
|
|
if d == nil {
|
|
return 0
|
|
}
|
|
return time.Duration((d.Seconds * int64(time.Second)) + int64(d.Nanos))
|
|
}
|