pdapi

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTimeout = 5 * time.Second
)

Variables

This section is empty.

Functions

func GetTLSConfig

func GetTLSConfig(kubeCli kubernetes.Interface, namespace Namespace, tcName string, caCert []byte) (*tls.Config, error)

GetTLSConfig returns *tls.Config for given TiDB cluster. It loads in-cluster root ca if caCert is empty.

func PDEtcdClientURL

func PDEtcdClientURL(namespace Namespace, clusterName string) string

func PdClientURL

func PdClientURL(namespace Namespace, clusterName string, scheme string) string

pdClientUrl builds the url of pd client

Types

type Action

type Action struct {
	ID          uint64
	Name        string
	Labels      map[string]string
	Replication PDReplicationConfig
}

type ActionType

type ActionType string
const (
	GetHealthActionType                ActionType = "GetHealth"
	GetConfigActionType                ActionType = "GetConfig"
	GetClusterActionType               ActionType = "GetCluster"
	GetMembersActionType               ActionType = "GetMembers"
	GetStoresActionType                ActionType = "GetStores"
	GetTombStoneStoresActionType       ActionType = "GetTombStoneStores"
	GetStoreActionType                 ActionType = "GetStore"
	DeleteStoreActionType              ActionType = "DeleteStore"
	SetStoreStateActionType            ActionType = "SetStoreState"
	DeleteMemberByIDActionType         ActionType = "DeleteMemberByID"
	DeleteMemberActionType             ActionType = "DeleteMember "
	SetStoreLabelsActionType           ActionType = "SetStoreLabels"
	UpdateReplicationActionType        ActionType = "UpdateReplicationConfig"
	BeginEvictLeaderActionType         ActionType = "BeginEvictLeader"
	EndEvictLeaderActionType           ActionType = "EndEvictLeader"
	GetEvictLeaderSchedulersActionType ActionType = "GetEvictLeaderSchedulers"
	GetPDLeaderActionType              ActionType = "GetPDLeader"
	TransferPDLeaderActionType         ActionType = "TransferPDLeader"
)

type FakePDClient

type FakePDClient struct {
	// contains filtered or unexported fields
}

func NewFakePDClient

func NewFakePDClient() *FakePDClient

func (*FakePDClient) AddReaction

func (pc *FakePDClient) AddReaction(actionType ActionType, reaction Reaction)

func (*FakePDClient) BeginEvictLeader

func (pc *FakePDClient) BeginEvictLeader(storeID uint64) error

func (*FakePDClient) DeleteMember

func (pc *FakePDClient) DeleteMember(name string) error

func (*FakePDClient) DeleteMemberByID

func (pc *FakePDClient) DeleteMemberByID(id uint64) error

func (*FakePDClient) DeleteStore

func (pc *FakePDClient) DeleteStore(id uint64) error

func (*FakePDClient) EndEvictLeader

func (pc *FakePDClient) EndEvictLeader(storeID uint64) error

func (*FakePDClient) GetCluster

func (pc *FakePDClient) GetCluster() (*metapb.Cluster, error)

func (*FakePDClient) GetConfig

func (pc *FakePDClient) GetConfig() (*PDConfigFromAPI, error)

func (*FakePDClient) GetEvictLeaderSchedulers

func (pc *FakePDClient) GetEvictLeaderSchedulers() ([]string, error)

func (*FakePDClient) GetHealth

func (pc *FakePDClient) GetHealth() (*HealthInfo, error)

func (*FakePDClient) GetMembers

func (pc *FakePDClient) GetMembers() (*MembersInfo, error)

func (*FakePDClient) GetPDLeader

func (pc *FakePDClient) GetPDLeader() (*pdpb.Member, error)

func (*FakePDClient) GetStore

func (pc *FakePDClient) GetStore(id uint64) (*StoreInfo, error)

func (*FakePDClient) GetStores

func (pc *FakePDClient) GetStores() (*StoresInfo, error)

func (*FakePDClient) GetTombStoneStores

func (pc *FakePDClient) GetTombStoneStores() (*StoresInfo, error)

func (*FakePDClient) SetStoreLabels

func (pc *FakePDClient) SetStoreLabels(storeID uint64, labels map[string]string) (bool, error)

SetStoreLabels sets TiKV labels

func (*FakePDClient) SetStoreState

func (pc *FakePDClient) SetStoreState(id uint64, state string) error

func (*FakePDClient) TransferPDLeader

func (pc *FakePDClient) TransferPDLeader(memberName string) error

func (*FakePDClient) UpdateReplicationConfig

func (pc *FakePDClient) UpdateReplicationConfig(config PDReplicationConfig) error

UpdateReplicationConfig updates the replication config

type FakePDControl

type FakePDControl struct {
	// contains filtered or unexported fields
}

func NewFakePDControl

func NewFakePDControl(kubeCli kubernetes.Interface) *FakePDControl

func (*FakePDControl) GetPDClient

func (pdc *FakePDControl) GetPDClient(namespace Namespace, tcName string, tlsEnabled bool) PDClient

GetPDClient provides a PDClient of real pd cluster,if the PDClient not existing, it will create new one.

func (*FakePDControl) GetPDEtcdClient

func (pdc *FakePDControl) GetPDEtcdClient(namespace Namespace, tcName string, tlsEnabled bool) (PDEtcdClient, error)

func (*FakePDControl) SetPDClient

func (fpc *FakePDControl) SetPDClient(namespace Namespace, tcName string, pdclient PDClient)

type FileLogConfig

type FileLogConfig struct {
	// Log filename, leave empty to disable file log.
	Filename string `toml:"filename,omitempty" json:"filename,omitempty"`
	// Is log rotate enabled.
	LogRotate bool `toml:"log-rotate,omitempty" json:"log-rotate,omitempty"`
	// Max size for a single file, in MB.
	MaxSize int `toml:"max-size,omitempty" json:"max-size,omitempty"`
	// Max log keep days, default is never deleting.
	MaxDays int `toml:"max-days,omitempty" json:"max-days,omitempty"`
	// Maximum number of old log files to retain.
	MaxBackups int `toml:"max-backups,omitempty" json:"max-backups,omitempty"`
}

+k8s:openapi-gen=true

type HealthInfo

type HealthInfo struct {
	Healths []MemberHealth
}

HealthInfo define PD's healthy info

type MemberHealth

type MemberHealth struct {
	Name       string   `json:"name"`
	MemberID   uint64   `json:"member_id"`
	ClientUrls []string `json:"client_urls"`
	Health     bool     `json:"health"`
}

MemberHealth define a pd member's healthy info

type MembersInfo

type MembersInfo struct {
	Header     *pdpb.ResponseHeader `json:"header,omitempty"`
	Members    []*pdpb.Member       `json:"members,omitempty"`
	Leader     *pdpb.Member         `json:"leader,omitempty"`
	EtcdLeader *pdpb.Member         `json:"etcd_leader,omitempty"`
}

MembersInfo is PD members info returned from PD RESTful interface type Members map[string][]*pdpb.Member

type MetaStore

type MetaStore struct {
	*metapb.Store
	StateName string `json:"state_name"`
}

MetaStore is TiKV store status defined in protobuf

type Namespace

type Namespace string

Namespace is a newtype of a string

type NotFoundReaction

type NotFoundReaction struct {
	// contains filtered or unexported fields
}

func (*NotFoundReaction) Error

func (nfr *NotFoundReaction) Error() string

type PDClient

type PDClient interface {
	// GetHealth returns the PD's health info
	GetHealth() (*HealthInfo, error)
	// GetConfig returns PD's config
	GetConfig() (*PDConfigFromAPI, error)
	// GetCluster returns used when syncing pod labels.
	GetCluster() (*metapb.Cluster, error)
	// GetMembers returns all PD members from cluster
	GetMembers() (*MembersInfo, error)
	// GetStores lists all TiKV stores from cluster
	GetStores() (*StoresInfo, error)
	// GetTombStoneStores lists all tombstone stores from cluster
	GetTombStoneStores() (*StoresInfo, error)
	// GetStore gets a TiKV store for a specific store id from cluster
	GetStore(storeID uint64) (*StoreInfo, error)
	// storeLabelsEqualNodeLabels compares store labels with node labels
	// for historic reasons, PD stores TiKV labels as []*StoreLabel which is a key-value pair slice
	SetStoreLabels(storeID uint64, labels map[string]string) (bool, error)
	// UpdateReplicationConfig updates the replication config
	UpdateReplicationConfig(config PDReplicationConfig) error
	// DeleteStore deletes a TiKV store from cluster
	DeleteStore(storeID uint64) error
	// SetStoreState sets store to specified state.
	SetStoreState(storeID uint64, state string) error
	// DeleteMember deletes a PD member from cluster
	DeleteMember(name string) error
	// DeleteMemberByID deletes a PD member from cluster
	DeleteMemberByID(memberID uint64) error
	// BeginEvictLeader initiates leader eviction for a storeID.
	// This is used when upgrading a pod.
	BeginEvictLeader(storeID uint64) error
	// EndEvictLeader is used at the end of pod upgrade.
	EndEvictLeader(storeID uint64) error
	// GetEvictLeaderSchedulers gets schedulers of evict leader
	GetEvictLeaderSchedulers() ([]string, error)
	// GetPDLeader returns pd leader
	GetPDLeader() (*pdpb.Member, error)
	// TransferPDLeader transfers pd leader to specified member
	TransferPDLeader(name string) error
}

PDClient provides pd server's api

func NewPDClient

func NewPDClient(url string, timeout time.Duration, tlsConfig *tls.Config) PDClient

NewPDClient returns a new PDClient

type PDConfigFromAPI

type PDConfigFromAPI struct {

	// Log related config.
	Log *PDLogConfig `toml:"log,omitempty" json:"log,omitempty"`

	// Immutable, change should be made through pd-ctl after cluster creation
	Schedule *PDScheduleConfig `toml:"schedule,omitempty" json:"schedule,omitempty"`

	// Immutable, change should be made through pd-ctl after cluster creation
	Replication *PDReplicationConfig `toml:"replication,omitempty" json:"replication,omitempty"`
}

PDConfigFromAPI is the configuration from PD API +k8s:openapi-gen=true

type PDControlInterface

type PDControlInterface interface {
	// GetPDClient provides PDClient of the tidb cluster.
	GetPDClient(Namespace, string, bool) PDClient
	// GetPDEtcdClient provides PD etcd Client of the tidb cluster.
	GetPDEtcdClient(namespace Namespace, tcName string, tlsEnabled bool) (PDEtcdClient, error)
}

PDControlInterface is an interface that knows how to manage and get tidb cluster's PD client

func NewDefaultPDControl

func NewDefaultPDControl(kubeCli kubernetes.Interface) PDControlInterface

NewDefaultPDControl returns a defaultPDControl instance

type PDEtcdClient

type PDEtcdClient interface {
	// PutKey will put key to the target pd etcd cluster
	PutKey(key, value string) error
	// DeleteKey will delete key from the target pd etcd cluster
	DeleteKey(key string) error
}

func NewPdEtcdClient

func NewPdEtcdClient(url string, timeout time.Duration, tlsConfig *tls.Config) (PDEtcdClient, error)

type PDLabelPropertyConfig

type PDLabelPropertyConfig map[string]PDStoreLabels

type PDLogConfig

type PDLogConfig struct {
	// Log level.
	// Optional: Defaults to info
	Level string `toml:"level,omitempty" json:"level,omitempty"`
	// Log format. one of json, text, or console.
	Format string `toml:"format,omitempty" json:"format,omitempty"`
	// Disable automatic timestamps in output.
	DisableTimestamp *bool `toml:"disable-timestamp,omitempty" json:"disable-timestamp,omitempty"`
	// File log config.
	File *FileLogConfig `toml:"file,omitempty" json:"file,omitempty"`
	// Development puts the logger in development mode, which changes the
	// behavior of DPanicLevel and takes stacktraces more liberally.
	Development *bool `toml:"development,omitempty" json:"development,omitempty"`
	// DisableCaller stops annotating logs with the calling function's file
	// name and line number. By default, all logs are annotated.
	DisableCaller *bool `toml:"disable-caller,omitempty" json:"disable-caller,omitempty"`
	// DisableStacktrace completely disables automatic stacktrace capturing. By
	// default, stacktraces are captured for WarnLevel and above logs in
	// development and ErrorLevel and above in production.
	DisableStacktrace *bool `toml:"disable-stacktrace,omitempty" json:"disable-stacktrace,omitempty"`
	// DisableErrorVerbose stops annotating logs with the full verbose error
	// message.
	DisableErrorVerbose *bool `toml:"disable-error-verbose,omitempty" json:"disable-error-verbose,omitempty"`
}

PDLogConfig serializes log related config in toml/json. +k8s:openapi-gen=true

type PDReplicationConfig

type PDReplicationConfig struct {
	// MaxReplicas is the number of replicas for each region.
	// Immutable, change should be made through pd-ctl after cluster creation
	// Optional: Defaults to 3
	MaxReplicas *uint64 `toml:"max-replicas,omitempty" json:"max-replicas,omitempty"`

	// The label keys specified the location of a store.
	// The placement priorities is implied by the order of label keys.
	// For example, ["zone", "rack"] means that we should place replicas to
	// different zones first, then to different racks if we don't have enough zones.
	// Immutable, change should be made through pd-ctl after cluster creation
	// +k8s:openapi-gen=false
	LocationLabels StringSlice `toml:"location-labels,omitempty" json:"location-labels,omitempty"`
	// StrictlyMatchLabel strictly checks if the label of TiKV is matched with LocaltionLabels.
	// Immutable, change should be made through pd-ctl after cluster creation.
	// Imported from v3.1.0
	StrictlyMatchLabel *bool `toml:"strictly-match-label,omitempty" json:"strictly-match-label,string,omitempty"`

	// When PlacementRules feature is enabled. MaxReplicas and LocationLabels are not used anymore.
	EnablePlacementRules *bool `toml:"enable-placement-rules" json:"enable-placement-rules,string,omitempty"`
}

PDReplicationConfig is the replication configuration. +k8s:openapi-gen=true

type PDScheduleConfig

type PDScheduleConfig struct {
	// If the snapshot count of one store is greater than this value,
	// it will never be used as a source or target store.
	// Immutable, change should be made through pd-ctl after cluster creation
	// Optional: Defaults to 3
	MaxSnapshotCount *uint64 `toml:"max-snapshot-count,omitempty" json:"max-snapshot-count,omitempty"`
	// Immutable, change should be made through pd-ctl after cluster creation
	// Optional: Defaults to 16
	MaxPendingPeerCount *uint64 `toml:"max-pending-peer-count,omitempty" json:"max-pending-peer-count,omitempty"`
	// If both the size of region is smaller than MaxMergeRegionSize
	// and the number of rows in region is smaller than MaxMergeRegionKeys,
	// it will try to merge with adjacent regions.
	// Immutable, change should be made through pd-ctl after cluster creation
	// Optional: Defaults to 20
	MaxMergeRegionSize *uint64 `toml:"max-merge-region-size,omitempty" json:"max-merge-region-size,omitempty"`
	// Immutable, change should be made through pd-ctl after cluster creation
	// Optional: Defaults to 200000
	MaxMergeRegionKeys *uint64 `toml:"max-merge-region-keys,omitempty" json:"max-merge-region-keys,omitempty"`
	// SplitMergeInterval is the minimum interval time to permit merge after split.
	// Immutable, change should be made through pd-ctl after cluster creation
	// Optional: Defaults to 1h
	SplitMergeInterval string `toml:"split-merge-interval,omitempty" json:"split-merge-interval,omitempty"`
	// PatrolRegionInterval is the interval for scanning region during patrol.
	// Immutable, change should be made through pd-ctl after cluster creation
	PatrolRegionInterval string `toml:"patrol-region-interval,omitempty" json:"patrol-region-interval,omitempty"`
	// MaxStoreDownTime is the max duration after which
	// a store will be considered to be down if it hasn't reported heartbeats.
	// Immutable, change should be made through pd-ctl after cluster creation
	// Optional: Defaults to 30m
	MaxStoreDownTime string `toml:"max-store-down-time,omitempty" json:"max-store-down-time,omitempty"`
	// LeaderScheduleLimit is the max coexist leader schedules.
	// Immutable, change should be made through pd-ctl after cluster creation.
	// Optional: Defaults to 4.
	// Imported from v3.1.0
	LeaderScheduleLimit *uint64 `toml:"leader-schedule-limit,omitempty" json:"leader-schedule-limit,omitempty"`
	// RegionScheduleLimit is the max coexist region schedules.
	// Immutable, change should be made through pd-ctl after cluster creation
	// Optional: Defaults to 2048
	RegionScheduleLimit *uint64 `toml:"region-schedule-limit,omitempty" json:"region-schedule-limit,omitempty"`
	// ReplicaScheduleLimit is the max coexist replica schedules.
	// Immutable, change should be made through pd-ctl after cluster creation
	// Optional: Defaults to 64
	ReplicaScheduleLimit *uint64 `toml:"replica-schedule-limit,omitempty" json:"replica-schedule-limit,omitempty"`
	// MergeScheduleLimit is the max coexist merge schedules.
	// Immutable, change should be made through pd-ctl after cluster creation
	// Optional: Defaults to 8
	MergeScheduleLimit *uint64 `toml:"merge-schedule-limit,omitempty" json:"merge-schedule-limit,omitempty"`
	// HotRegionScheduleLimit is the max coexist hot region schedules.
	// Immutable, change should be made through pd-ctl after cluster creation
	// Optional: Defaults to 4
	HotRegionScheduleLimit *uint64 `toml:"hot-region-schedule-limit,omitempty" json:"hot-region-schedule-limit,omitempty"`
	// HotRegionCacheHitThreshold is the cache hits threshold of the hot region.
	// If the number of times a region hits the hot cache is greater than this
	// threshold, it is considered a hot region.
	// Immutable, change should be made through pd-ctl after cluster creation
	HotRegionCacheHitsThreshold *uint64 `toml:"hot-region-cache-hits-threshold,omitempty" json:"hot-region-cache-hits-threshold,omitempty"`
	// TolerantSizeRatio is the ratio of buffer size for balance scheduler.
	// Immutable, change should be made through pd-ctl after cluster creation.
	// Imported from v3.1.0
	TolerantSizeRatio *float64 `toml:"tolerant-size-ratio,omitempty" json:"tolerant-size-ratio,omitempty"`
	//
	//      high space stage         transition stage           low space stage
	//   |--------------------|-----------------------------|-------------------------|
	//   ^                    ^                             ^                         ^
	//   0       HighSpaceRatio * capacity       LowSpaceRatio * capacity          capacity
	//
	// LowSpaceRatio is the lowest usage ratio of store which regraded as low space.
	// When in low space, store region score increases to very large and varies inversely with available size.
	// Immutable, change should be made through pd-ctl after cluster creation
	LowSpaceRatio *float64 `toml:"low-space-ratio,omitempty" json:"low-space-ratio,omitempty"`
	// HighSpaceRatio is the highest usage ratio of store which regraded as high space.
	// High space means there is a lot of spare capacity, and store region score varies directly with used size.
	// Immutable, change should be made through pd-ctl after cluster creation
	HighSpaceRatio *float64 `toml:"high-space-ratio,omitempty" json:"high-space-ratio,omitempty"`
	// DisableLearner is the option to disable using AddLearnerNode instead of AddNode
	// Immutable, change should be made through pd-ctl after cluster creation
	DisableLearner *bool `toml:"disable-raft-learner,omitempty" json:"disable-raft-learner,string,omitempty"`

	// DisableRemoveDownReplica is the option to prevent replica checker from
	// removing down replicas.
	// Immutable, change should be made through pd-ctl after cluster creation
	DisableRemoveDownReplica *bool `toml:"disable-remove-down-replica,omitempty" json:"disable-remove-down-replica,string,omitempty"`
	// DisableReplaceOfflineReplica is the option to prevent replica checker from
	// repalcing offline replicas.
	// Immutable, change should be made through pd-ctl after cluster creation
	DisableReplaceOfflineReplica *bool `toml:"disable-replace-offline-replica,omitempty" json:"disable-replace-offline-replica,string,omitempty"`
	// DisableMakeUpReplica is the option to prevent replica checker from making up
	// replicas when replica count is less than expected.
	// Immutable, change should be made through pd-ctl after cluster creation
	DisableMakeUpReplica *bool `toml:"disable-make-up-replica,omitempty" json:"disable-make-up-replica,string,omitempty"`
	// DisableRemoveExtraReplica is the option to prevent replica checker from
	// removing extra replicas.
	// Immutable, change should be made through pd-ctl after cluster creation
	DisableRemoveExtraReplica *bool `toml:"disable-remove-extra-replica,omitempty" json:"disable-remove-extra-replica,string,omitempty"`
	// DisableLocationReplacement is the option to prevent replica checker from
	// moving replica to a better location.
	// Immutable, change should be made through pd-ctl after cluster creation
	DisableLocationReplacement *bool `toml:"disable-location-replacement,omitempty" json:"disable-location-replacement,string,omitempty"`
	// DisableNamespaceRelocation is the option to prevent namespace checker
	// from moving replica to the target namespace.
	// Immutable, change should be made through pd-ctl after cluster creation
	DisableNamespaceRelocation *bool `toml:"disable-namespace-relocation,omitempty" json:"disable-namespace-relocation,string,omitempty"`

	// Schedulers support for loding customized schedulers
	// Immutable, change should be made through pd-ctl after cluster creation
	Schedulers *PDSchedulerConfigs `toml:"schedulers,omitempty" json:"schedulers-v2,omitempty"` // json v2 is for the sake of compatible upgrade

	// Only used to display
	SchedulersPayload map[string]string `toml:"schedulers-payload" json:"schedulers-payload,omitempty"`

	// EnableOneWayMerge is the option to enable one way merge. This means a Region can only be merged into the next region of it.
	// Imported from v3.1.0
	EnableOneWayMerge *bool `toml:"enable-one-way-merge" json:"enable-one-way-merge,string,omitempty"`
	// EnableCrossTableMerge is the option to enable cross table merge. This means two Regions can be merged with different table IDs.
	// This option only works when key type is "table".
	// Imported from v3.1.0
	EnableCrossTableMerge *bool `toml:"enable-cross-table-merge" json:"enable-cross-table-merge,string,omitempty"`
}

ScheduleConfig is the schedule configuration. +k8s:openapi-gen=true

type PDSchedulerConfig

type PDSchedulerConfig struct {
	// Immutable, change should be made through pd-ctl after cluster creation
	Type string `toml:"type,omitempty" json:"type,omitempty"`
	// Immutable, change should be made through pd-ctl after cluster creation
	Args []string `toml:"args,omitempty" json:"args,omitempty"`
	// Immutable, change should be made through pd-ctl after cluster creation
	Disable *bool `toml:"disable,omitempty" json:"disable,omitempty"`
}

PDSchedulerConfig is customized scheduler configuration +k8s:openapi-gen=true

type PDSchedulerConfigs

type PDSchedulerConfigs []PDSchedulerConfig

type PDStoreLabel

type PDStoreLabel struct {
	Key   string `toml:"key,omitempty" json:"key,omitempty"`
	Value string `toml:"value,omitempty" json:"value,omitempty"`
}

PDStoreLabel is the config item of LabelPropertyConfig. +k8s:openapi-gen=true

type PDStoreLabels

type PDStoreLabels []PDStoreLabel

type Reaction

type Reaction func(action *Action) (interface{}, error)

type StoreInfo

type StoreInfo struct {
	Store  *MetaStore   `json:"store"`
	Status *StoreStatus `json:"status"`
}

StoreInfo is a single store info returned from PD RESTful interface

type StoreStatus

type StoreStatus struct {
	Capacity           typeutil.ByteSize `json:"capacity"`
	Available          typeutil.ByteSize `json:"available"`
	LeaderCount        int               `json:"leader_count"`
	RegionCount        int               `json:"region_count"`
	SendingSnapCount   uint32            `json:"sending_snap_count"`
	ReceivingSnapCount uint32            `json:"receiving_snap_count"`
	ApplyingSnapCount  uint32            `json:"applying_snap_count"`
	IsBusy             bool              `json:"is_busy"`

	StartTS         time.Time         `json:"start_ts"`
	LastHeartbeatTS time.Time         `json:"last_heartbeat_ts"`
	Uptime          typeutil.Duration `json:"uptime"`
}

StoreStatus is TiKV store status returned from PD RESTful interface

type StoresInfo

type StoresInfo struct {
	Count  int          `json:"count"`
	Stores []*StoreInfo `json:"stores"`
}

StoresInfo is stores info returned from PD RESTful interface

type StringSlice

type StringSlice []string

StringSlice is more friendly to json encode/decode

func (StringSlice) MarshalJSON

func (s StringSlice) MarshalJSON() ([]byte, error)

MarshalJSON returns the size as a JSON string.

func (*StringSlice) UnmarshalJSON

func (s *StringSlice) UnmarshalJSON(text []byte) error

UnmarshalJSON parses a JSON string into the bytesize.

Jump to

Keyboard shortcuts

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